- 🔭 I’m currently working on 42 projects
- 🌱 I’m currently learning C++
- 📫 How to reach me: [email protected]
benoitroux0 / cub3d Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://projects.intra.42.fr/cub3d/mine
Home Page: https://projects.intra.42.fr/cub3d/mine
True for Mandatory and Bonus part, see attached valgrind log file.
Step to reproduce :
Make re
valgrind --leak-check=full --show-leak-kinds=all ./cub3D maps/good/dungeon.cubvalgrind --leak-check=full --show-leak-kinds=all --log-file=val.log ./cub3D maps/good/dungeon.cub
Quit immediately
Apparemment le parsing est "éclatax" selon les dire de son créateur.
srcs/img/ft_xpm_to_img.c:27:12: error: conflicting types for 'ft_xpm_to_img'
t_uint_img ft_xpm_to_img(void *mlx_ptr, char *path)
^
incs/img.h:180:13: note: previous declaration is here
t_uint_img *ft_xpm_to_img(void *mlx_ptr, char *path);
Ton avis sur la gestion des espaces dans les map ? Je suis d'avis de les traiter comme un sol, t'en penses quoi ?
gd-harco in ~/Documents/level_4/cub3D on fixes ● ● λ valgrind --track-origins=yes ./cub3D_bonus maps/good/matrix.cub
==103327== Memcheck, a memory error detector
==103327== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==103327== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==103327== Command: ./cub3D_bonus maps/good/matrix.cub
==103327==
==103327== Conditional jump or move depends on uninitialised value(s)
==103327== at 0x4A3BDE2: __cos_fma (s_sin.c:280)
==103327== by 0x403CD7: draw_wall_slice (render_bonus.c:54)
==103327== by 0x403B20: render (render_bonus.c:29)
==103327== by 0x403F7F: render_to_window (render_bonus.c:107)
==103327== by 0x4037C4: render_locked_fps (frame_second_bonus.c:42)
==103327== by 0x40283E: main (main_bonus.c:41)
==103327== Uninitialised value was created by a stack allocation
==103327== at 0x404710: cast_vert (casts_bonus.c:20)
==103327==
==103327== Conditional jump or move depends on uninitialised value(s)
==103327== at 0x4A3BDE2: __cos_fma (s_sin.c:280)
==103327== by 0x403CD7: draw_wall_slice (render_bonus.c:54)
==103327== by 0x403C0C: render (render_bonus.c:35)
==103327== by 0x403F7F: render_to_window (render_bonus.c:107)
==103327== by 0x4037C4: render_locked_fps (frame_second_bonus.c:42)
==103327== by 0x40283E: main (main_bonus.c:41)
==103327== Uninitialised value was created by a stack allocation
==103327== at 0x404B70: cast_horiz (casts_bonus.c:43)
==103327==
==103327== Conditional jump or move depends on uninitialised value(s)
==103327== at 0x4A3BDE2: __cos_fma (s_sin.c:280)
==103327== by 0x403CD7: draw_wall_slice (render_bonus.c:54)
==103327== by 0x403B96: render (render_bonus.c:32)
==103327== by 0x403F7F: render_to_window (render_bonus.c:107)
==103327== by 0x4037C4: render_locked_fps (frame_second_bonus.c:42)
==103327== by 0x40283E: main (main_bonus.c:41)
==103327== Uninitialised value was created by a stack allocation
==103327== at 0x404710: cast_vert (casts_bonus.c:20)
==103327==
==103327==
==103327== HEAP SUMMARY:
==103327== in use at exit: 0 bytes in 0 blocks
==103327== total heap usage: 51,678 allocs, 51,678 frees, 47,482,111 bytes allocated
==103327==
==103327== All heap blocks were freed -- no leaks are possible
==103327==
==103327== For lists of detected and suppressed errors, rerun with: -s
==103327== ERROR SUMMARY: 1800 errors from 3 contexts (suppressed: 1 from 1)
With an invalid map file :
==21428== 88 bytes in 1 blocks are still reachable in loss record 1 of 1
==21428== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21428== by 0x11575E: add_gamepad (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21428== by 0x1156F6: init_gamepads (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21428== by 0x10FBCF: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
With a valid map and no input :
HEAP SUMMARY:
==21515== in use at exit: 4,398,776 bytes in 935 blocks
==21515== total heap usage: 69,478 allocs, 68,543 frees, 115,561,250 bytes allocated
==21515==
==21515== 40 bytes in 1 blocks are still reachable in loss record 1 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x112C39: new_mlx_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x112B37: img_to_mlx_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x110F14: render_to_window (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FCE3: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 88 bytes in 1 blocks are still reachable in loss record 2 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x111C14: init_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FC67: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 88 bytes in 1 blocks are still reachable in loss record 3 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x111C14: init_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x110335: create_map (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FCB7: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 88 bytes in 1 blocks are still reachable in loss record 4 of 9
==21515== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1163EB: mlx_int_new_xshm_image (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x116712: mlx_new_image (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x112C62: new_mlx_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x112B37: img_to_mlx_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x110F14: render_to_window (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FCE3: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 136 bytes in 1 blocks are still reachable in loss record 5 of 9
==21515== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x48750C3: XShmCreateImage (in /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0)
==21515== by 0x116416: mlx_int_new_xshm_image (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x116712: mlx_new_image (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x112C62: new_mlx_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x112B37: img_to_mlx_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x110F14: render_to_window (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FCE3: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 1,280 bytes in 1 blocks are still reachable in loss record 6 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x111C4F: init_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x110335: create_map (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FCB7: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 6,144 bytes in 1 blocks are still reachable in loss record 7 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x111C4F: init_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FC67: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 194,560 bytes in 160 blocks are still reachable in loss record 8 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x111CA5: init_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x110335: create_map (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FCB7: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== 4,196,352 bytes in 768 blocks are still reachable in loss record 9 of 9
==21515== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==21515== by 0x1187B2: ft_calloc (ft_calloc.c:21)
==21515== by 0x111CA5: init_img (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515== by 0x10FC67: main (in /home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus)
==21515==
==21515== LEAK SUMMARY:
==21515== definitely lost: 0 bytes in 0 blocks
==21515== indirectly lost: 0 bytes in 0 blocks
==21515== possibly lost: 0 bytes in 0 blocks
==21515== still reachable: 4,398,776 bytes in 935 blocks
==21515== suppressed: 0 bytes in 0 blocks
==21515==
step to reproduce :
./cub3D_bonus maps/map1_bonus.cub avec fsanitize.
==12427==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6030000f1a3a at pc 0x558e6b88e9e3 bp 0x7ffd830b08a0 sp 0x7ffd830b0890
READ of size 1 at 0x6030000f1a3a thread T0
#0 0x558e6b88e9e2 in create_map bonus/srcs/minimap_bonus.c:33
#1 0x558e6b88d248 in main bonus/srcs/main_bonus.c:35
#2 0x7fec856abd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#3 0x7fec856abe3f in __libc_start_main_impl ../csu/libc-start.c:392
#4 0x558e6b88ce44 in _start (/home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus+0x9e44)
0x6030000f1a3a is located 0 bytes to the right of 26-byte region [0x6030000f1a20,0x6030000f1a3a)
allocated by thread T0 here:
#0 0x7fec85bb6887 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
#1 0x558e6b8a90e5 in ft_strdup (/home/gd-harco/Documents/42/level_4/cub3D/cub3D_bonus+0x260e5)
#2 0x558e6b89c530 in parsing bonus/srcs/parsing/parsing_bonus.c:34
#3 0x558e6b88d07b in main bonus/srcs/main_bonus.c:26
#4 0x7fec856abd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
SUMMARY: AddressSanitizer: heap-buffer-overflow bonus/srcs/minimap_bonus.c:33 in create_map
Shadow bytes around the buggy address:
0x0c06800162f0: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
0x0c0680016300: fa fa fd fd fd fa fa fa fd fd fd fa fa fa fd fd
0x0c0680016310: fd fa fa fa fd fd fd fa fa fa fd fd fd fa fa fa
0x0c0680016320: fd fd fd fa fa fa fd fd fd fa fa fa fd fd fd fa
0x0c0680016330: fa fa fd fd fd fa fa fa fd fd fd fd fa fa fd fd
=>0x0c0680016340: fd fd fa fa 00 00 00[02]fa fa 00 00 00 02 fa fa
0x0c0680016350: fd fd fd fa fa fa fd fd fd fd fa fa 00 00 00 02
0x0c0680016360: fa fa fd fd fd fa fa fa 00 00 00 02 fa fa 00 00
0x0c0680016370: 00 02 fa fa 00 00 00 02 fa fa 00 00 00 02 fa fa
0x0c0680016380: 00 00 00 02 fa fa fd fd fd fa fa fa 00 00 00 02
0x0c0680016390: fa fa 00 00 00 02 fa fa 00 00 00 02 fa fa 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
==12427==ABORTING
`
srcs/parsing/get_textures.c: In function ‘open_texture’:
srcs/parsing/get_textures.c:70:19: error: incompatible types when assigning to type ‘t_uint_img’ {aka ‘struct s_uint_img’} from type ‘t_uint_img *’ {aka ‘struct s_uint_img *’}
70 | = ft_xpm_to_img(data->mlx,
| ^~~~~~~~~~~~~
srcs/parsing/get_textures.c:75:19: error: incompatible types when assigning to type ‘t_uint_img’ {aka ‘struct s_uint_img’} from type ‘t_uint_img *’ {aka ‘struct s_uint_img *’}
75 | = ft_xpm_to_img(data->mlx,
| ^~~~~~~~~~~~~
srcs/parsing/get_textures.c:80:19: error: incompatible types when assigning to type ‘t_uint_img’ {aka ‘struct s_uint_img’} from type ‘t_uint_img *’ {aka ‘struct s_uint_img *’}
80 | = ft_xpm_to_img(data->mlx,
| ^~~~~~~~~~~~~
srcs/parsing/get_textures.c:85:19: error: incompatible types when assigning to type ‘t_uint_img’ {aka ‘struct s_uint_img’} from type ‘t_uint_img *’ {aka ‘struct s_uint_img *’}
85 | = ft_xpm_to_img(data->mlx,
| ^~~~~~~~~~~~~
make: *** [Makefile:34 : srcs/parsing/get_textures.o] Erreur 1
==================
WARNING: ThreadSanitizer: data race (pid=602059)
Write of size 1 at 0x7b8c00000028 by thread T1:
#0 update_gamepads bonus/srcs/gamepad/update_gamepads_bonus.c:38 (cub3D_bonus+0x14b47)
#1 input_loop bonus/srcs/gamepad/input_loop_bonus.c:24 (cub3D_bonus+0x15d01)
Previous read of size 1 at 0x7b8c00000028 by main thread:
[failed to restore the stack]
Location is heap block of size 6224 at 0x7b8c00000000 allocated by main thread:
#0 malloc ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:655 (libtsan.so.0+0x31c57)
#1 add_gamepad bonus/srcs/gamepad/init_gamepads_bonus.c:43 (cub3D_bonus+0x150f3)
#2 init_gamepads bonus/srcs/gamepad/init_gamepads_bonus.c:28 (cub3D_bonus+0x1502c)
#3 main bonus/srcs/main_bonus.c:28 (cub3D_bonus+0x8fa6)
Thread T1 (tid=602064, running) created by main thread at:
#0 pthread_create ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:969 (libtsan.so.0+0x605b8)
#1 init_gamepads bonus/srcs/gamepad/init_gamepads_bonus.c:32 (cub3D_bonus+0x15089)
#2 main bonus/srcs/main_bonus.c:28 (cub3D_bonus+0x8fa6)
ThreadSanitizer: reported 1 warnings
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.