mirror of https://github.com/pwndbg/pwndbg.git
Add regression test for `find_fake_fast` command (#1147)
* Add a regression test for find_fake_fast The test program creates a fake chunk size field in its .data section with a set NON_MAIN_ARENA flag. The Python test runs the find_fake_fast command on an address succeeding the fake chunk. A gdb.MemoryError indicates regression - issue #1142 * Make linter happypull/1150/head
parent
88c610116e
commit
636db8b25f
@ -0,0 +1,26 @@
|
||||
/* Test the find_fake_fast command.
|
||||
*
|
||||
* No need to test the output as find_fake_fast wraps malloc_chunk,
|
||||
* which can be tested separately.
|
||||
*
|
||||
* Just test for the command completing without a crash.
|
||||
* Purposefully pass a fake chunk with no parent arena, with a set
|
||||
* NON_MAIN_ARENA flag to ensure no error occurs when attempting to read
|
||||
* the non-existent heap_info struct - issue #1142
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
void break_here(void) {}
|
||||
|
||||
// Fake chunk size field with a set NON_MAIN_ARENA flag.
|
||||
// Enough space afterwards to ensure only this fake size field is a candidate.
|
||||
char fake_chunk[0x80] __attribute__((aligned(0x10))) = "XXXXXXXX\x7f";
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// Initialize malloc so heap commands can run.
|
||||
void* m = malloc(0x18);
|
||||
|
||||
break_here();
|
||||
}
|
||||
Loading…
Reference in new issue