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

IMAGE_allocate will attempt to load a nonexistent file, causing a crash #4

Closed
scholar-mage opened this issue May 30, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@scholar-mage
Copy link
Contributor

Dome will attempt to load invalid resource paths, which causes a segfault. For example, rename ship1.png to something else, and you'll get the following crash:

Loading module audio
Loading module input
Loading module graphics
Loading module point
Loading module random
Loading module io

Thread 1 "dome" received signal SIGSEGV, Segmentation fault.
0x000055555556ed75 in stbi__get8 (s=0x7fffffffbb30) at src/include/stb_image.h:1409
1409	      return *s->img_buffer++;
(gdb) where
#0  0x000055555556ed75 in stbi__get8 (s=0x7fffffffbb30) at src/include/stb_image.h:1409
#1  0x0000555555575e26 in stbi__get_marker (j=0x5555576b5500) at src/include/stb_image.h:2660
#2  0x000055555557866c in stbi__decode_jpeg_header (z=0x5555576b5500, scan=1)
    at src/include/stb_image.h:3098
#3  0x000055555557bc04 in stbi__jpeg_test (s=0x7fffffffbb30) at src/include/stb_image.h:3750
#4  0x000055555556dc4f in stbi__load_main (s=0x7fffffffbb30, x=0x5555576b54d8, y=0x5555576b54dc, 
    comp=0x5555576b54e0, req_comp=4, ri=0x7fffffffbadc, bpc=8) at src/include/stb_image.h:980
#5  0x000055555556e0c9 in stbi__load_and_postprocess_8bit (s=0x7fffffffbb30, x=0x5555576b54d8, 
    y=0x5555576b54dc, comp=0x5555576b54e0, req_comp=4) at src/include/stb_image.h:1088
#6  0x000055555556e7ec in stbi_load_from_memory (buffer=0x0, len=1431883287, x=0x5555576b54d8, 
    y=0x5555576b54dc, comp=0x5555576b54e0, req_comp=4) at src/include/stb_image.h:1226
#7  0x0000555555567f5e in IMAGE_allocate (vm=0x5555575c2c20) at src/engine/image.c:19
#8  0x000055555558b3ff in runInterpreter ()
#9  0x0000555555569deb in main (argc=1, args=0x7fffffffde58) at src/main.c:172
@avivbeeri avivbeeri added the bug Something isn't working label Jun 4, 2019
@avivbeeri avivbeeri mentioned this issue Dec 23, 2019
@avivbeeri
Copy link
Collaborator

This is fixed for asset loading, but will need to be revisited when async loading is introduced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants