Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heap-buffer-overflow in def_symbol #365

Open
clesmian opened this issue Aug 8, 2023 · 1 comment
Open

heap-buffer-overflow in def_symbol #365

clesmian opened this issue Aug 8, 2023 · 1 comment

Comments

@clesmian
Copy link

clesmian commented Aug 8, 2023

When executing c2m on poc.txt, a segfault occurs

POC

enum {x}x;

ASAN Output

=================================================================
==2370992==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000002558 at pc 0x55c3244e208e bp 0x7fc6d8afbf80 sp 0x7fc6d8afbf70
READ of size 32 at 0x602000002558 thread T1
    #0 0x55c3244e208d in def_symbol c2mir/c2mir.c:6404
    #1 0x55c32452edec in create_decl c2mir/c2mir.c:7771
    #2 0x55c32450d5c7 in check c2mir/c2mir.c:9159
    #3 0x55c324510b1f in check c2mir/c2mir.c:8286
    #4 0x55c324510099 in check c2mir/c2mir.c:9431
    #5 0x55c324553314 in do_context c2mir/c2mir.c:9697
    #6 0x55c324553314 in c2mir_compile c2mir/c2mir.c:13481
    #7 0x55c324556d6a in compile c2mir/c2mir-driver.c:498
    #8 0x7fc6dc181608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
    #9 0x7fc6dc0a6132 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f132)

Address 0x602000002558 is a wild pointer.
SUMMARY: AddressSanitizer: heap-buffer-overflow c2mir/c2mir.c:6404 in def_symbol
Shadow bytes around the buggy address:
  0x0c047fff8450: fa fa 00 02 fa fa 06 fa fa fa 07 fa fa fa 00 01
  0x0c047fff8460: fa fa 07 fa fa fa 00 01 fa fa 00 01 fa fa 00 00
  0x0c047fff8470: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 fa
  0x0c047fff8480: fa fa 00 01 fa fa 00 fa fa fa 00 02 fa fa 00 01
  0x0c047fff8490: fa fa 00 03 fa fa 00 03 fa fa 00 05 fa fa 02 fa
=>0x0c047fff84a0: fa fa 04 fa fa fa 00 fa fa fa fa[fa]fa fa fa fa
  0x0c047fff84b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff84c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff84d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff84e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c047fff84f0: 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
Thread T1 created by T0 here:
    #0 0x7fc6dc32b815 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cc:208
    #1 0x55c32446b6f8 in init_compilers c2mir/c2mir-driver.c:540
    #2 0x55c32446b6f8 in main c2mir/c2mir-driver.c:656

==2370992==ABORTING

Found while fuzzing d51b45f, verified with cf3c9c1

@clesmian clesmian changed the title heap-buffer-overflow in def_symbol heap-buffer-overflow in def_symbol Aug 8, 2023
vnmakarov added a commit that referenced this issue Aug 8, 2023
@vnmakarov
Copy link
Owner

I fixed this one by 86456a6

vnmakarov added a commit that referenced this issue Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants