cloudwu / pbc

A protocol buffers library for C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

heap-buffer-overflow in _pbcM_ip_new src/map.c:143

EnchantedJohn opened this issue · comments

Hello.I use my company tool.I found two heapoverflow.There is Second one.Then I want to provide more information.I hope will hope your guys.

then I use ASAN. I fond heap-buffer-overflow.then the following more information.

==34441==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000eed0 at pc 0x406a79 bp 0x7ffcccc85bd0 sp 0x7ffcccc85bc8
READ of size 4 at 0x60200000eed0 thread T0
    #0 0x406a78 in _pbcM_ip_new src/map.c:143
    #1 0x40494b in _pbcP_push_enum src/proto.c:83
    #2 0x402617 in _register_enum src/register.c:52
    #3 0x403ad1 in _register src/register.c:235
    #4 0x404044 in _register_no_dependency src/register.c:296
    #5 0x404310 in pbc_register src/register.c:329
    #6 0x401e42 in test_decode ../test/decode.c:67
    #7 0x401f10 in main ../test/decode.c:79
    #8 0x7f6e4420ef44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #9 0x401408 (/home/lx/github/6_27/pbc/pbc-master/build/decode+0x401408)

0x60200000eed1 is located 0 bytes to the right of 1-byte region [0x60200000eed0,0x60200000eed1)
allocated by thread T0 here:
    #0 0x7f6e4460a862 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x54862)
    #1 0x409036 in _pbcM_malloc src/alloc.c:8
    #2 0x402445 in _register_enum src/register.c:39
    #3 0x403ad1 in _register src/register.c:235
    #4 0x404044 in _register_no_dependency src/register.c:296
    #5 0x404310 in pbc_register src/register.c:329
    #6 0x401e42 in test_decode ../test/decode.c:67
    #7 0x401f10 in main ../test/decode.c:79
    #8 0x7f6e4420ef44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)

SUMMARY: AddressSanitizer: heap-buffer-overflow src/map.c:143 _pbcM_ip_new
Shadow bytes around the buggy address:
  0x0c047fff9d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9d90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9da0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9db0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9dc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c047fff9dd0: fa fa fa fa fa fa fa fa fa fa[01]fa fa fa 00 00
  0x0c047fff9de0: fa fa 00 00 fa fa fd fd fa fa fd fd fa fa fd fd
  0x0c047fff9df0: fa fa fd fd fa fa fd fd fa fa 00 00 fa fa fd fd
  0x0c047fff9e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff9e20: 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
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==34441==ABORTING