src/trap: Fix isclearpath out of bound access on levl array#1194
Merged
Conversation
Do isok check apriori to accessing the levl array to filter out dx/dy that have grown too large. This fixes: trap.c:3455:19: runtime error: index 80 out of bounds for type 'rm [80][21]'
Contributor
|
This has been added to the pipeline. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do isok check apriori to accessing the levl array to filter out dx/dy that have grown too large.
This fixes:
trap.c:3455:19: runtime error: index 80 out of bounds for type 'rm [80][21]'
trap.c:3455:19: runtime error: index 80 out of bounds for type 'rm [80][21]'
#0 0x55555752ee50 in isclearpath /home/miku/src/NetHack/src/trap.c:3455
#1 0x55555752df40 in find_random_launch_coord /home/miku/src/NetHack/src/trap.c:3383
#2 0x55555752e333 in mkroll_launch /home/miku/src/NetHack/src/trap.c:3415
#3 0x5555574fccec in maketrap /home/miku/src/NetHack/src/trap.c:508
#4 0x555556f42f4b in mktrap /home/miku/src/NetHack/src/mklev.c:1848
#5 0x55555740deee in create_trap /home/miku/src/NetHack/src/sp_lev.c:1820
#6 0x5555574358b3 in lspo_trap /home/miku/src/NetHack/src/sp_lev.c:4369
#7 0x55555779b212 in luaD_precall (/home/miku/src/NetHack/src/nethack+0x2247212) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)
#8 0x5555577aa3b4 in luaV_execute (/home/miku/src/NetHack/src/nethack+0x22563b4) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)
#9 0x55555779b52c in luaD_callnoyield (/home/miku/src/NetHack/src/nethack+0x224752c) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)
#10 0x55555779a3e2 in luaD_rawrunprotected (/home/miku/src/NetHack/src/nethack+0x22463e2) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)
#11 0x55555779b913 in luaD_pcall (/home/miku/src/NetHack/src/nethack+0x2247913) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)
#12 0x555557797de4 in lua_pcallk (/home/miku/src/NetHack/src/nethack+0x2243de4) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)
#13 0x5555570deb44 in nhl_pcall /home/miku/src/NetHack/src/nhlua.c:1900
#14 0x5555570df2f8 in nhl_pcall_handle /home/miku/src/NetHack/src/nhlua.c:1924
#15 0x5555570e014d in nhl_loadlua /home/miku/src/NetHack/src/nhlua.c:2037
#16 0x5555570e0c77 in load_lua /home/miku/src/NetHack/src/nhlua.c:2158
#17 0x55555745d696 in load_special /home/miku/src/NetHack/src/sp_lev.c:7046
#18 0x555556f66dc1 in makemaz /home/miku/src/NetHack/src/mkmaze.c:1127
#19 0x555556f37e0d in makelevel /home/miku/src/NetHack/src/mklev.c:1087
#20 0x555556f3da30 in mklev /home/miku/src/NetHack/src/mklev.c:1384
#21 0x555556bb85f2 in goto_level /home/miku/src/NetHack/src/do.c:1669
#22 0x555556bbd26a in deferred_goto /home/miku/src/NetHack/src/do.c:2035
#23 0x5555569b2a05 in moveloop_core /home/miku/src/NetHack/src/allmain.c:497
#24 0x5555569b33c3 in moveloop /home/miku/src/NetHack/src/allmain.c:547
#25 0x5555577032e9 in main ../sys/unix/unixmain.c:310
#26 0x7ffff74280cf in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#27 0x7ffff7428188 in __libc_start_main_impl ../csu/libc-start.c:360
#28 0x5555568a07e4 in _start (/home/miku/src/NetHack/src/nethack+0x134c7e4) (BuildId: 903e3f1003850a814e470c2e0f9b0752dcb0d06a)