Skip to content

AddressSanitizer: global-buffer-overflow #7

@tankf33der

Description

@tankf33der
$ clang -g -fno-omit-frame-pointer -fsanitize=address geohash_test.c geohash.c
./a.out
=================================================================
==145148==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55ba71db93e0 at pc 0x55ba71cf095b bp 0x7fff48e04d10 sp 0x7fff48e044c0
READ of size 33 at 0x55ba71db93e0 thread T0
    #0 0x55ba71cf095a in __interceptor_strlen.part.0 (/home/mpech/libgeohash/a.out+0x6895a)
    #1 0x55ba71d8326f in index_for_char /home/mpech/libgeohash/geohash.c:83:25
    #2 0x55ba71d83f1e in geohash_decode /home/mpech/libgeohash/geohash.c:209:33
    #3 0x55ba71d826cd in main /home/mpech/libgeohash/geohash_test.c:84:22
    #4 0x7f83bb758151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
    #5 0x55ba71ca919d in _start (/home/mpech/libgeohash/a.out+0x2119d)

0x55ba71db93e0 is located 0 bytes to the right of global variable 'char_map' defined in 'geohash.c:59:13' (0x55ba71db93c0) of size 32
SUMMARY: AddressSanitizer: global-buffer-overflow (/home/mpech/libgeohash/a.out+0x6895a) in __interceptor_strlen.part.0
Shadow bytes around the buggy address:
  0x0ab7ce3af220: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af230: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af240: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af250: f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 f9 f9 f9 f9
  0x0ab7ce3af260: 00 00 00 00 f9 f9 f9 f9 00 00 00 00 f9 f9 f9 f9
=>0x0ab7ce3af270: 00 00 00 00 f9 f9 f9 f9 00 00 00 00[f9]f9 f9 f9
  0x0ab7ce3af280: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af290: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af2a0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af2b0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0ab7ce3af2c0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
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
==145148==ABORTING
make: *** [Makefile:12: test] Error 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions