KrolPolski / cube3D

0 stars 0 forks source link

some maps cause segfault on launch #16

Open KrolPolski opened 2 hours ago

KrolPolski commented 2 hours ago
 % ./cub3d maps/valid/subject.cub 
We must have suceeded in loading textures
txt_no: 0x603000030160 txt_ea: 0x603000030670 txt_so: 0x603000030b80 txt_we: 0x603000031090Our starting position is y: 11.500000, x: 26.500000, orientation is 4.712389
        1111111111111111111111111
        1000000000110000000000001
        1011000001110000000000001
        1001000000000000000000001
111111111011000001110000000000001
100000000011000001110111111111111
11110111111111011100000010001    
11110111111111011101010010001    
11000000110101011100000010001    
10000000000000001100000010001    
10000000000000001101010010001    
11000001110101011111011110N0111  
11110111 1110101 101111010001    
11111111 1111111 111111111111    
AddressSanitizer:DEADLYSIGNAL
=================================================================
==218383==ERROR: AddressSanitizer: FPE on unknown address 0x0000004cf9fe (pc 0x0000004cf9fe bp 0x7ffd9f4d7f80 sp 0x7ffd9f4d7ef0 T0)
    #0 0x4cf9fe in cast_wall (/home/rboudwin/repos/cube3D/cub3d+0x4cf9fe)
    #1 0x4cfd39 in raycaster (/home/rboudwin/repos/cube3D/cub3d+0x4cfd39)
    #2 0x4ced28 in setup_mlx (/home/rboudwin/repos/cube3D/cub3d+0x4ced28)
    #3 0x4cb4ba in main (/home/rboudwin/repos/cube3D/cub3d+0x4cb4ba)
    #4 0x75db78429d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #5 0x75db78429e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #6 0x41f544 in _start (/home/rboudwin/repos/cube3D/cub3d+0x41f544)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE (/home/rboudwin/repos/cube3D/cub3d+0x4cf9fe) in cast_wall
==218383==ABORTING
rboudwin@c2r2p1 ~/repos/cube3D
 % ./cub3d maps/valid/bigger.cub 
We must have suceeded in loading textures
txt_no: 0x603000030940 txt_ea: 0x603000030e50 txt_so: 0x603000031360 txt_we: 0x603000031870Our starting position is y: 11.500000, x: 26.500000, orientation is 4.712389
        1111111111111111111111111       11111
        1000000000110000000000001111111110001
        1011000001110000000000000000000000001
        1001000000000000000000001111111111111
111111111011000001110000000000001            
100000000011000001110111110111111            
11110111111111011100000010001                
11110111111111011101010010001                
11000000110101011100000010001                
10000000000000001100000010001                
10000000000000001101010010001                
11000001110101011111011110N0111              
11110111 1110101 101011010001                
11110111 1111101 111011110001                
   101  1111110111110111100011111            
   101  1000000000110000000000001            
   101  1011000001110000000000001            
   101  1001000000000000000000001            
111101111011000001110000000000001            
100000000011000001110111110111111            
11110111111111011100000010001                
11110111111111011101010010001                
11000000110101011100000010001                
10000000000000001100000010001                
10000000000000001101010010001                
1100000111010101111101111000111              
11110111 1110101 101111010001                
11111111 1111111 111111111111                
AddressSanitizer:DEADLYSIGNAL
=================================================================
==218396==ERROR: AddressSanitizer: FPE on unknown address 0x0000004cf9fe (pc 0x0000004cf9fe bp 0x7ffc4f0f0f40 sp 0x7ffc4f0f0eb0 T0)
    #0 0x4cf9fe in cast_wall (/home/rboudwin/repos/cube3D/cub3d+0x4cf9fe)
    #1 0x4cfd39 in raycaster (/home/rboudwin/repos/cube3D/cub3d+0x4cfd39)
    #2 0x4ced28 in setup_mlx (/home/rboudwin/repos/cube3D/cub3d+0x4ced28)
    #3 0x4cb4ba in main (/home/rboudwin/repos/cube3D/cub3d+0x4cb4ba)
    #4 0x78ad84829d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #5 0x78ad84829e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #6 0x41f544 in _start (/home/rboudwin/repos/cube3D/cub3d+0x41f544)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: FPE (/home/rboudwin/repos/cube3D/cub3d+0x4cf9fe) in cast_wall
==218396==ABORTING
rboudwin@c2r2p1 ~/repos/cube3D

These maps worked before texture mapping was implemented, not sure what is wrong now.

KrolPolski commented 2 hours ago

This seems to be an issue because the texture being referenced is quite large (2000px by 2000px). This is bigger than the column_height can ever be and it is breaking some of our math

Should we bother fixing this? Or just use smaller textures?

KrolPolski commented 1 hour ago

I've implemented a fix that resizes textures over 256 x 256 to 256 x 256. Seems to have resolved this