================================================================= ==30787==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x615000000280 at pc 0x00000050cad3 bp 0x7ffd4e4d7c70 sp 0x7ffd4e4d7c68 READ of size 4 at 0x615000000280 thread T0 #0 0x50cad2 in dump /home/hongxu/tests/jsmn/example/jsondump.c:33:9 #1 0x50ca00 in dump /home/hongxu/tests/jsmn/example/jsondump.c:46:9 #2 0x50bed3 in main /home/hongxu/tests/jsmn/example/jsondump.c:120:4 #3 0x7f8e2026b1c0 in __libc_start_main /build/glibc-itYbWN/glibc-2.26/csu/../csu/libc-start.c:308 #4 0x41c5d9 in _start (/home/hongxu/tests/jsmn/jsondump+0x41c5d9) 0x615000000280 is located 0 bytes to the right of 512-byte region [0x615000000080,0x615000000280) allocated by thread T0 here: #0 0x4d2045 in realloc (/home/hongxu/tests/jsmn/jsondump+0x4d2045) #1 0x50bdbc in realloc_it /home/hongxu/tests/jsmn/example/jsondump.c:15:12 #2 0x50bdbc in main /home/hongxu/tests/jsmn/example/jsondump.c:113 #3 0x7f8e2026b1c0 in __libc_start_main /build/glibc-itYbWN/glibc-2.26/csu/../csu/libc-start.c:308 SUMMARY: AddressSanitizer: heap-buffer-overflow /home/hongxu/tests/jsmn/example/jsondump.c:33:9 in dump Shadow bytes around the buggy address: 0x0c2a7fff8000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2a7fff8010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2a7fff8020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2a7fff8030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c2a7fff8040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c2a7fff8050:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2a7fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2a7fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2a7fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2a7fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c2a7fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==30787==ABORTING