Add tests for find_fake_fast --align

This commit is contained in:
Gulshan Singh 2022-10-06 18:35:15 -07:00
parent 9a783c08ce
commit dac5340b18
2 changed files with 37 additions and 2 deletions

View File

@ -71,7 +71,7 @@ int main(void) {
setup_mem(0x80, 0x78);
break_here();
// A valid unaligned fastbin chunk just in range of the target address
/* // A valid unaligned fastbin chunk just in range of the target address */
/* setup_mem(0x80, 0x7F); */
/* break_here(); */

View File

@ -61,39 +61,60 @@ def test_find_fake_fast_command(start_binary):
# setup_mem(0x20, 0x8)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_result(result, 0x20)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_result(result, 0x20)
gdb.execute("continue")
# setup_mem(0x2F, 0x8)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_result(result, 0x2F)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_result(result, 0x2F)
gdb.execute("continue")
# setup_mem(0x20, 0x9)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_result(result, 0x20)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_no_results(result)
gdb.execute("continue")
# setup_mem(0x20, 0x0)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_no_results(result)
gdb.execute("continue")
# setup_mem(0x20, 0x7)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_no_results(result)
gdb.execute("continue")
# setup_mem(0x1F, 0x8)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_no_results(result)
gdb.execute("continue")
# setup_mem(0x80, 0x78)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_result(result, 0x80)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_result(result, 0x80)
gdb.execute("continue")
# setup_mem(0x80, 0x7F)
# # setup_mem(0x80, 0x7F)
# result = gdb.execute("find_fake_fast &target_address", to_string=True)
# check_result(result, 0x80)
# gdb.execute("continue")
@ -101,17 +122,31 @@ def test_find_fake_fast_command(start_binary):
# setup_mem(0x80, 0x80)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast --align &target_address", to_string=True)
check_no_results(result)
gdb.execute("continue")
# setup_mem(0x100, 0x10)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast &target_address 0x100", to_string=True)
check_result(result, 0x100)
gdb.execute("continue")
# setup_mem(0x100, 0x90)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast &target_address 0x100", to_string=True)
check_result(result, 0x100)
gdb.execute("continue")
# setup_mem(0x100, 0x100)
result = gdb.execute("find_fake_fast &target_address", to_string=True)
check_no_results(result)
result = gdb.execute("find_fake_fast &target_address 0x100", to_string=True)
check_no_results(result)
gdb.execute("continue")