tpecholt / imrad

ImRAD is a GUI builder for the ImGui library
GNU General Public License v3.0
872 stars 26 forks source link

Sigmentation fault #30

Closed colesnicov closed 3 months ago

colesnicov commented 4 months ago

Hello.

Method:

You can see the result below, as shown by valgrind:

denis@denis-OMEN:~/opt/imrad2/install/imrad-0.7$ valgrind ./imrad 
==163686== Memcheck, a memory error detector
==163686== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==163686== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==163686== Command: ./imrad
==163686== 
==163686== Invalid read of size 8
==163686==    at 0x40286A8: strncmp (strcmp.S:172)
==163686==    by 0x400668D: is_dst (dl-load.c:216)
==163686==    by 0x400810E: _dl_dst_count (dl-load.c:253)
==163686==    by 0x400810E: expand_dynamic_string_token (dl-load.c:395)
==163686==    by 0x40082B7: fillin_rpath.isra.0 (dl-load.c:483)
==163686==    by 0x4008602: decompose_rpath (dl-load.c:654)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:696)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:677)
==163686==    by 0x400ABF5: _dl_map_object (dl-load.c:2165)
==163686==    by 0x4003494: openaux (dl-deps.c:64)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==163686==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==163686==  Address 0x7da6b59 is 9 bytes inside a block of size 15 alloc'd
==163686==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==163686==    by 0x40271DF: malloc (rtld-malloc.h:56)
==163686==    by 0x40271DF: strdup (strdup.c:42)
==163686==    by 0x4008594: decompose_rpath (dl-load.c:629)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:696)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:677)
==163686==    by 0x400ABF5: _dl_map_object (dl-load.c:2165)
==163686==    by 0x4003494: openaux (dl-deps.c:64)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==163686==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x400E34D: _dl_open (dl-open.c:883)
==163686== 
==163686== Invalid read of size 8
==163686==    at 0x40286A8: strncmp (strcmp.S:172)
==163686==    by 0x400668D: is_dst (dl-load.c:216)
==163686==    by 0x4007F79: _dl_dst_substitute (dl-load.c:295)
==163686==    by 0x40082B7: fillin_rpath.isra.0 (dl-load.c:483)
==163686==    by 0x4008602: decompose_rpath (dl-load.c:654)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:696)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:677)
==163686==    by 0x400ABF5: _dl_map_object (dl-load.c:2165)
==163686==    by 0x4003494: openaux (dl-deps.c:64)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==163686==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==163686==  Address 0x7da6b59 is 9 bytes inside a block of size 15 alloc'd
==163686==    at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==163686==    by 0x40271DF: malloc (rtld-malloc.h:56)
==163686==    by 0x40271DF: strdup (strdup.c:42)
==163686==    by 0x4008594: decompose_rpath (dl-load.c:629)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:696)
==163686==    by 0x400ABF5: cache_rpath (dl-load.c:677)
==163686==    by 0x400ABF5: _dl_map_object (dl-load.c:2165)
==163686==    by 0x4003494: openaux (dl-deps.c:64)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x4003C7B: _dl_map_object_deps (dl-deps.c:248)
==163686==    by 0x400EA0E: dl_open_worker_begin (dl-open.c:592)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x400DF99: dl_open_worker (dl-open.c:782)
==163686==    by 0x581EA97: _dl_catch_exception (dl-error-skeleton.c:208)
==163686==    by 0x400E34D: _dl_open (dl-open.c:883)
==163686== 
==163686== Invalid read of size 4
==163686==    at 0x22293B: ImGui::OpenPopupEx(unsigned int, int) (in /home/denis/opt/imrad2/install/imrad-0.7/imrad)
==163686==    by 0x1652E0: CloseFile() (in /home/denis/opt/imrad2/install/imrad-0.7/imrad)
==163686==    by 0x12B0AD: main (in /home/denis/opt/imrad2/install/imrad-0.7/imrad)
==163686==  Address 0x130 is not stack'd, malloc'd or (recently) free'd
==163686== 
==163686== 
==163686== Process terminating with default action of signal 11 (SIGSEGV)
==163686==  Access not within mapped region at address 0x130
==163686==    at 0x22293B: ImGui::OpenPopupEx(unsigned int, int) (in /home/denis/opt/imrad2/install/imrad-0.7/imrad)
==163686==    by 0x1652E0: CloseFile() (in /home/denis/opt/imrad2/install/imrad-0.7/imrad)
==163686==    by 0x12B0AD: main (in /home/denis/opt/imrad2/install/imrad-0.7/imrad)
==163686==  If you believe this happened as a result of a stack
==163686==  overflow in your program's main thread (unlikely but
==163686==  possible), you can try to increase the size of the
==163686==  main thread stack using the --main-stacksize= flag.
==163686==  The main thread stack size used in this run was 8388608.
==163686== 
==163686== HEAP SUMMARY:
==163686==     in use at exit: 26,512,463 bytes in 63,166 blocks
==163686==   total heap usage: 185,518 allocs, 122,352 frees, 164,607,717 bytes allocated
==163686== 
==163686== LEAK SUMMARY:
==163686==    definitely lost: 408 bytes in 7 blocks
==163686==    indirectly lost: 0 bytes in 0 blocks
==163686==      possibly lost: 6,236,403 bytes in 44,324 blocks
==163686==    still reachable: 20,233,604 bytes in 18,445 blocks
==163686==                       of which reachable via heuristic:
==163686==                         newarray           : 768,888 bytes in 9 blocks
==163686==                         multipleinheritance: 6,016 bytes in 16 blocks
==163686==         suppressed: 0 bytes in 0 blocks
==163686== Rerun with --leak-check=full to see details of leaked memory
==163686== 
==163686== For lists of detected and suppressed errors, rerun with: -s
==163686== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
Neoprávněný přístup do paměti (SIGSEGV) (core dumped [obraz paměti uložen])
tpecholt commented 3 months ago

I can't reproduce this. On my machine confirmation dialog appears as a result of ImGui::OpenPopupEx and there is no crash.

Can you build ImRAD with debug info (use provided release-linux script, change cmake invocation to DCMAKE_BUILD_TYPE=Debug) then run it from gdb and post the exact backtrace of the crash?

tpecholt commented 3 months ago

Okay seems I finally found it. The required action is Alt+F4 (app close) not Ctrl+F4 (tab close). Fixed.