Issue861

Title set neighbor level to removed level; crash
Priority important Status resolved
Assigned To fluzz Keywords editor
Linked issues Watchers fluzz

Submitted on 2016-08-15 14h02 by matthiaskrgr, last changed by fluzz.

Messages
Author: matthiaskrgr Date: 2016-08-15   14h02
Go to level 12 and remove it.
Go to level 0, set one of the borders to level 12 (this should not be possible).
If I now try to scroll near the level border, the game crashes

view.c:550:23: runtime error: member access within null pointer of type 'level'
(aka 'struct level')
SUMMARY: AddressSanitizer: undefined-behavior view.c:550:23 in 
view.c:550:23: runtime error: load of null pointer of type 'int'
SUMMARY: AddressSanitizer: undefined-behavior view.c:550:23 in 
ASAN:DEADLYSIGNAL
=================================================================
==5935==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc
0x00000069aaee bp 0x7ffde047b4f0 sp 0x7ffde047b4c0 T0)
==5935==The signal is caused by a READ memory access.
==5935==Hint: address points to the zero page.
    #0 0x69aaed in level_is_visible
/home/matthias/vcs/copy_of_git/freedroid/src/view.c:550:23
    #1 0x6a6d03 in insert_enemies_into_blitting_list
/home/matthias/vcs/copy_of_git/freedroid/src/view.c:1082:9
    #2 0x6a6d03 in set_up_ordered_blitting_list
/home/matthias/vcs/copy_of_git/freedroid/src/view.c:1234
    #3 0x6b53b5 in AssembleCombatPicture
/home/matthias/vcs/copy_of_git/freedroid/src/view.c:1821:2
    #4 0x6decc5 in leveleditor_display
/home/matthias/vcs/copy_of_git/freedroid/src/lvledit/lvledit_display.c:299:2
    #5 0x6cab29 in LevelEditor
/home/matthias/vcs/copy_of_git/freedroid/src/lvledit/lvledit.c:287:3
    #6 0x609652 in main /home/matthias/vcs/copy_of_git/freedroid/src/main.c:183:4
    #7 0x7f2200b23730 in __libc_start_main (/lib64/libc.so.6+0x20730)
    #8 0x42f838 in _start
(/home/matthias/vcs/copy_of_git/freedroid/src/freedroidRPG+0x42f838)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV
/home/matthias/vcs/copy_of_git/freedroid/src/view.c:550:23 in level_is_visible
==5935==ABORTING
Author: jesusalva Date: 2016-08-16   11h48
Have you tried setting to level, say, 94?

This is probably the game using maximum 
level to assume the existent levels.
If you remove level 12 the lvl 12 will 
cesse existing but the engine might 
assume it still exists because the 
highest level number is 73.

Procedures might include checking if lvl 
exists when setting borders, or falling 
bsck to -1.
Author: fluzz Date: 2016-10-17   16h31
Fixed in commit 7f8fda9
History
Date User Action Args
2016-10-17 16:31:23fluzzsetstatus: open -> resolved
assignedto: fluzz
messages: + msg3365
nosy: + fluzz
2016-08-16 11:48:15jesusalvasetmessages: + msg3352
2016-08-15 14:02:54matthiaskrgrcreate