(stack_size = 0x1000, upper_pad = 0x10000)
| 173 | // upper_pad: the amount of extra space above stack |
| 174 | export class ChainBase { |
| 175 | constructor(stack_size = 0x1000, upper_pad = 0x10000) { |
| 176 | this._is_dirty = false; |
| 177 | this.position = 0; |
| 178 | |
| 179 | const return_value = new Uint32Array(4); |
| 180 | this._return_value = return_value; |
| 181 | this.retval_addr = get_view_vector(return_value); |
| 182 | |
| 183 | const errno = new Uint32Array(1); |
| 184 | this._errno = errno; |
| 185 | this.errno_addr = get_view_vector(errno); |
| 186 | |
| 187 | const full_stack_size = upper_pad + stack_size; |
| 188 | const stack_buffer = new ArrayBuffer(full_stack_size); |
| 189 | const stack = new DataView(stack_buffer, upper_pad); |
| 190 | this.stack = stack; |
| 191 | this.stack_addr = get_view_vector(stack); |
| 192 | this.stack_size = stack_size; |
| 193 | this.full_stack_size = full_stack_size; |
| 194 | } |
| 195 | |
| 196 | // use this if you want to write a new ROP chain but don't want to allocate |
| 197 | // a new instance |
nothing calls this directly
no test coverage detected