HackRVA / badge2023

Software for electronic badges for RVASec 2023
2 stars 1 forks source link

Bug in pathfinding in goodbye gulag #7

Open smcameron opened 1 year ago

smcameron commented 1 year ago

Not sure how this happened:

READ of size 1 at 0x55a7bc5c2cea thread T1
    #0 0x55a7bc553479 in cost_fn /home/scameron/github/badge2023/source/apps/gulag.c:1948
    #1 0x55a7bc5686ba in a_star /home/scameron/github/badge2023/source/core/a_star.c:232
    #2 0x55a7bc55f2d3 in move_soldier /home/scameron/github/badge2023/source/apps/gulag.c:4165
    #3 0x55a7bc5614d7 in move_objects /home/scameron/github/badge2023/source/apps/gulag.c:4388
    #4 0x55a7bc56151e in gulag_run /home/scameron/github/badge2023/source/apps/gulag.c:4399
    #5 0x55a7bc562b20 in gulag_cb /home/scameron/github/badge2023/source/apps/gulag.c:4707
    #6 0x55a7bc56c77f in menus /home/scameron/github/badge2023/source/core/menu.c:263
    #7 0x55a7bc568f95 in ProcessIO /home/scameron/github/badge2023/source/core/badge.c:177
    #8 0x55a7bc52e6dc in badge_main /home/scameron/github/badge2023/source/main.c:79
    #9 0x55a7bc5760d7 in main_in_thread /home/scameron/github/badge2023/source/hal/init_sdl_sim.c:47
    #10 0x7f05e32bc608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477
    #11 0x7f05e31e1132 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x11f132)

0x55a7bc5c2cea is located 10 bytes to the right of global variable 'room_cost' defined in '/home/scameron/github/badge2023/source/apps/gulag.c:229:22' (0x55a7bc5c28e0) of size 1024
0x55a7bc5c2cea is located 22 bytes to the left of global variable 'nodeset1' defined in '/home/scameron/github/badge2023/source/apps/gulag.c:233:22' (0x55a7bc5c2d00) of size 8200
SUMMARY: AddressSanitizer: global-buffer-overflow /home/scameron/github/badge2023/source/apps/gulag.c:1948 in cost_fn
Shadow bytes around the buggy address:
  0x0ab5778b0540: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b0550: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b0560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b0570: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b0580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0ab5778b0590: 00 00 00 00 00 00 00 00 00 00 00 00 f9[f9]f9 f9
  0x0ab5778b05a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b05b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b05c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b05d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0ab5778b05e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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 0x7f05e34ba815 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cc:208
    #1 0x55a7bc5761e7 in hal_run_main /home/scameron/github/badge2023/source/hal/init_sdl_sim.c:57
    #2 0x55a7bc52e791 in main /home/scameron/github/badge2023/source/main.c:97
    #3 0x7f05e30e6082 in __libc_start_main ../csu/libc-start.c:308

==31563==ABORTING