0

While writing this

while(chars[i]==chars[j]&&j<n)

i'm getting this error

=================================================================
==31==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000151 at pc 0x000000345dfc bp 0x7ffc573ff910 sp 0x7ffc573ff908
READ of size 1 at 0x602000000151 thread T0
#2 0x7f3ec3d8b0b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
0x602000000151 is located 0 bytes to the right of 1-byte region [0x602000000150,0x602000000151)
allocated by thread T0 here:
#6 0x7f3ec3d8b0b2 (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

Shadow bytes around the buggy address:
0x0c047fff7fd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7fe0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff7ff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c047fff8000: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa 0x0c047fff8010: fa fa fd fa fa fa fd fa fa fa fd fa fa fa fd fa =>0x0c047fff8020: fa fa fd fa fa fa fd fa fa fa[01]fa fa fa fa fa 0x0c047fff8030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c047fff8070: 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
Shadow gap: cc
==31==ABORTING
yugr
  • 19,769
  • 3
  • 51
  • 96
Roshhe
  • 1
  • Does this answer your question? [addressSanitizer: heap-buffer-overflow on address](https://stackoverflow.com/questions/51579267/addresssanitizer-heap-buffer-overflow-on-address) – Sudhir Ojha Oct 20 '22 at 10:34

0 Answers0