From 576a78b4de02c4c6566c327d85c465554d293975 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 12:49:15 -0300 Subject: design: the overflow as bytes; a minimap in each pane From the user. In the pair a frame is a dump of eight bytes a row read by its own fields, so each turn of the loop is one more letter and the letters are seen to cross from buf into the saved rbp and the return address, which reads as code until they reach it. Each pane with more than it shows carries its own minimap, a strip of its column of the map at four units a row with the pane's window outlined and what happens off the window marked there; the corner minimap is gone, and in the dive each column of the map folds into its pane's strip. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- design/mock/38-pair-ret.svg | 509 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 509 insertions(+) create mode 100644 design/mock/38-pair-ret.svg (limited to 'design/mock/38-pair-ret.svg') diff --git a/design/mock/38-pair-ret.svg b/design/mock/38-pair-ret.svg new file mode 100644 index 0000000..aec2130 --- /dev/null +++ b/design/mock/38-pair-ret.svg @@ -0,0 +1,509 @@ + + + + + + +overflow.c · both builds +lines 2 to 6 of 10 +2 +__attribute__ +( +( +noinline +) +) +static +void +fill +( +void +) +{ +3 +char +buf +[ +16 +] +; + + +4 +for +( +int +i += +0 +; +i +< +32 +; +i ++ ++ +) +buf +[ +i +] += +' +A +' +; +5 +} +6 + + +asan + + + + +disassembly +plain · fill +4011 +44 +4 +mov +[rbp - 0x14] + + + + +, 0 + +4011 +4b +cmp +[rbp - 0x14] + + + + +, 0x20 + +4011 +4f +jge +401165 + +4011 +51 +movsxd +rax, [rbp - 0x14] + + + + + + + + +4011 +55 +mov +[rbp + rax - 0x10] + +, 0x41 +7fffffffeceb + + +0x41 +65 +4011 +5a +mov +eax, [rbp - 0x14] +4011 +5d +add +eax, 1 +4011 +60 +mov +[rbp - 0x14], eax +4011 +63 +jmp +40114b + + + +plain · registers +the line's registers, and rip +rax +0x1b +27 +rbp +7fffffffece0 + + +0x4141414141414141 +rsp +7fffffffece0 + + +rip +401155 +fill+21 + + + +plain · stack +fill's frame as bytes, eight a row +7fffffffec +b0 +00 +00 +00 +00 +00 +00 +00 +00 +7fffffffec +b8 +00 +00 +00 +00 +00 +00 +00 +00 +7fffffffec +c0 +00 +00 +00 +00 +00 +00 +00 +00 +7fffffffec +c8 + + +1b +00 +00 +00 +i +27 +00 +00 +00 +00 +7fffffffec +d0 + +41 +41 +41 +41 +41 +41 +41 +41 +buf[0..7] +"AAAAAAAA" +7fffffffec +d8 + +41 +41 +41 +41 +41 +41 +41 +41 +buf[8..15] +"AAAAAAAA" +rbp rsp + +7fffffffec +e0 + +41 +41 +41 +41 +41 +41 +41 +41 +saved rbp +0x4141414141414141 + +7fffffffec +e8 + + +41 + +41 + +41 + +41 +00 +00 +00 +00 +return +0x41414141 + +7fffffffec +f0 +00 +00 +00 +00 +00 +00 +00 +00 +7fffffffec +f8 +00 +00 +00 +00 +00 +00 +00 +00 + + + +fill + + + +disassembly +asan · fill · stopped +523d +4b +4 +and +rax, 7 +523d +4f +cmp +al, cl + +523d +51 +jl +523d5b + +523d +53 +mov +rdi, [rbx] + +523d +56 +call +4e8450 +__asan_report_store1 +never returned + + + + + + + + +asan · stderr +its report, as written · exit 1 +==1438870==ERROR: AddressSanitizer: stack-buffer-overflow on address 0… + +WRITE of size 1 at 0x7bfff58f0030 thread T0 + +Address 0x7bfff58f0030 is located in stack of thread T0 at offset 48 i… + This frame has 1 object(s): + [32, 48) 'buf' (line 3) <== Memory access at offset 48 overflows t… + +=>0x7bfff58f0000: f1 f1 f1 f1 00 00[f3]f3 00 00 00 00 00 00 00 00 + + + + +asan · fake frame +its shadow at addr >> 3 + 7fff8000 · then the real stack's way back + +f1 +7bfff58f00 +00 + +b3 +8a +b5 +41 +00 +00 +00 +00 +magic + +f1 +7bfff58f00 +08 + +a7 +87 +53 +00 +00 +00 +00 +00 +descr + + +5387a7 +"1 32 16 5 b… + +f1 +7bfff58f00 +10 + +60 +3c +52 +00 +00 +00 +00 +00 +pc + + +523c60 +fill + +f1 +7bfff58f00 +18 + +10 +ec +ff +ff +ff +7f +00 +00 +real stack + + +7fffffffec10 +00 +7bfff58f00 +20 + +41 +41 +41 +41 +41 +41 +41 +41 +buf[0..7] +"AAAAAAAA" +00 +7bfff58f00 +28 + +41 +41 +41 +41 +41 +41 +41 +41 +buf[8..15] +"AAAAAAAA" + +f3 +7bfff58f00 +30 + +00 +00 +00 +00 +00 +00 +00 +00 +redzone + + +f3 +7bfff58f00 +38 + +00 +80 +8e +f5 +ff +7b +00 +00 +redzone + + +rbp + +7fffffffecc0 + +e0 +ec +ff +ff +ff +7f +00 +00 +saved rbp + + +7fffffffece0 +7fffffffecc8 + +54 +3c +52 +00 +00 +00 +00 +00 +return + + +523c54 +main+20 + + + +fill + + +i 27 · moment 252 · asan exited +i = 27: the return address is half 41s, and reads +41414141, no longer an address. ASan stopped at i = 16. + -- cgit v1.3