A variant of NetHack that is designed to be a much more challenging experience than the original, drawing inspiration and content from various existing variants along with adding unique and never-before-seen custom content.
Other
53
stars
22
forks
source link
global-buffer-overflow when initializing drow characters #127
Seems to be a problem when accessing the roles array - I'm guessing because it's trying to use flags.pantheon and maybe it isn't initialized? This only occurs when ASAN is enabled, and only for the drow race.
role.c: 2545-2546
while (!roles[flags.pantheon].lgod) /* unless they're missing */
flags.pantheon = randrole(FALSE);
=================================================================
==19564==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5555564cc5d8 at pc 0x555555fbedaf bp 0x7fffffffe440 sp 0x7fffffffe430
READ of size 8 at 0x5555564cc5d8 thread T0
#0 0x555555fbedae in role_init /home/lunatunez/EvilHack/src/role.c:2545
#1 0x555555744b6d in newgame /home/lunatunez/EvilHack/src/allmain.c:1014
#2 0x5555562b1ba9 in main ../sys/unix/unixmain.c:348
#3 0x7ffff7362082 in __libc_start_main ../csu/libc-start.c:308
#4 0x55555573aacd in _start (/home/lunatunez/games/evilhackdir/evilhack+0x1e6acd)
0x5555564cc5d8 is located 8 bytes to the left of global variable 'striped_msgs' defined in 'read.c:267:30' (0x5555564cc5e0) of size 80
0x5555564cc5d8 is located 40 bytes to the right of global variable 'explaintext' defined in 'pickup.c:2756:30' (0x5555564cc540) of size 112
SUMMARY: AddressSanitizer: global-buffer-overflow /home/lunatunez/EvilHack/src/role.c:2545 in role_init
Shadow bytes around the buggy address:
0x0aab2ac91860: 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
0x0aab2ac91870: 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9
0x0aab2ac91880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0aab2ac91890: 00 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
0x0aab2ac918a0: 00 00 00 00 f9 f9 f9 f9 00 00 00 00 00 00 00 00
=>0x0aab2ac918b0: 00 00 00 00 00 00 f9 f9 f9 f9 f9[f9]00 00 00 00
0x0aab2ac918c0: 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00
0x0aab2ac918d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0aab2ac918e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0aab2ac918f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0aab2ac91900: 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
==19564==ABORTING
Seems to be a problem when accessing the roles array - I'm guessing because it's trying to use flags.pantheon and maybe it isn't initialized? This only occurs when ASAN is enabled, and only for the drow race.
role.c: 2545-2546