parnoldx / nasc

Do maths like a normal person
http://parnoldx.github.io/nasc/
GNU General Public License v3.0
560 stars 37 forks source link

Crash on cut/paste #193

Open AlisterH opened 3 months ago

AlisterH commented 3 months ago

Describe the bug I seem to be able to reliably crash it by cutting and pasting multiple lines of input. I am testing with lines that are all just comments (i.e. starting with //) It doesn't seem to crash if the lines are blank.

(gdb) run
Starting program: /nix/store/xf4wzs6qy406i9xscly4yn7c6jkh5k6c-nasc-0.8.0/bin/com.github.parnold_x.nasc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libthread_db.so.1".
process 27868 is executing new program: /nix/store/xf4wzs6qy406i9xscly4yn7c6jkh5k6c-nasc-0.8.0/bin/.com.github.parnold_x.nasc-wrapped
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libthread_db.so.1".
[INFO 06:03:26.091870] Application.vala:142: NaSC version: 0.8.0
[INFO 06:03:26.091901] Application.vala:145: Kernel version: 5.15.153.1-microsoft-standard-WSL2
[New Thread 0x7fffe99556c0 (LWP 27871)]
[New Thread 0x7fffe91546c0 (LWP 27872)]
[New Thread 0x7fffe89536c0 (LWP 27873)]
[New Thread 0x7fffdbfff6c0 (LWP 27874)]
[New Thread 0x7fffdb7fe6c0 (LWP 27875)]
Gdk-Message: 06:03:26.154: Unable to load sb_h_double_arrow from the cursor theme
[New Thread 0x7fffda9866c0 (LWP 27876)]
Gdk-Message: 06:03:26.169: Unable to load hand2 from the cursor theme
[New Thread 0x7fffda1856c0 (LWP 27877)]
[Detaching after vfork from child process 27878]
Gdk-Message: 06:03:26.175: Unable to load hand2 from the cursor theme
Gdk-Message: 06:03:26.181: Unable to load col-resize from the cursor theme
Gdk-Message: 06:03:26.181: Unable to load col-resize from the cursor theme
Gdk-Message: 06:03:26.184: Unable to load col-resize from the cursor theme
Gdk-Message: 06:03:26.184: Unable to load col-resize from the cursor theme
Gdk-Message: 06:03:26.213: Unable to load col-resize from the cursor theme
Gdk-Message: 06:03:26.213: Unable to load col-resize from the cursor theme
[New Thread 0x7fffd98fc6c0 (LWP 27884)]
[New Thread 0x7fffc3fff6c0 (LWP 27885)]
[FATAL 06:03:26.672600] Calculator.vala:382: Error: Operation not supported
[Thread 0x7fffc3fff6c0 (LWP 27885) exited]
[Thread 0x7fffdbfff6c0 (LWP 27874) exited]
Gdk-Message: 06:03:53.910: Unable to load col-resize from the cursor theme
Gdk-Message: 06:03:53.910: Unable to load col-resize from the cursor theme
Gdk-Message: 06:06:08.877: Unable to load col-resize from the cursor theme
Gdk-Message: 06:06:08.877: Unable to load col-resize from the cursor theme
Gdk-Message: 06:06:19.957: Unable to load col-resize from the cursor theme
Gdk-Message: 06:06:19.957: Unable to load col-resize from the cursor theme
Gdk-Message: 06:12:13.894: Unable to load col-resize from the cursor theme
Gdk-Message: 06:12:13.894: Unable to load col-resize from the cursor theme
Gdk-Message: 06:12:16.808: Unable to load col-resize from the cursor theme
Gdk-Message: 06:12:16.808: Unable to load col-resize from the cursor theme
Gdk-Message: 06:21:35.359: Unable to load col-resize from the cursor theme
Gdk-Message: 06:21:35.359: Unable to load col-resize from the cursor theme
Gdk-Message: 06:21:40.103: Unable to load col-resize from the cursor theme
Gdk-Message: 06:22:34.234: Unable to load col-resize from the cursor theme
Gdk-Message: 06:22:34.235: Unable to load col-resize from the cursor theme
Gdk-Message: 06:22:57.059: Unable to load col-resize from the cursor theme
Gdk-Message: 06:22:57.059: Unable to load col-resize from the cursor theme

Thread 1 "nasc" received signal SIGSEGV, Segmentation fault.
0x00007ffff15789dd in __strlen_avx2 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
(gdb) bt
#0  0x00007ffff15789dd in __strlen_avx2 () from /nix/store/dbcw19dshdwnxdv5q2g6wldj6syyvq7l-glibc-2.39-52/lib/libc.so.6
#1  0x00007ffff7dc7208 in g_strdup () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libglib-2.0.so.0
#2  0x00000000004b4df0 in g_strdup_inline (str=<optimized out>) at /nix/store/z13ibxp4nkyqv38d268my5kraffjqwym-glib-2.80.2-dev/include/glib-2.0/glib/gstrfuncs.h:321
#3  controller_update_results_co (_data_=0x14b08f0) at com.github.parnold_x.nasc.p/src/Controller.c:1403
#4  0x00000000004b5329 in ______lambda32_ (_data4_=_data4_@entry=0x1495250, obj=<optimized out>, res=<optimized out>) at com.github.parnold_x.nasc.p/src/Controller.c:1284
#5  0x00000000004b537f in _______lambda32__gasync_ready_callback (source_object=<optimized out>, res=<optimized out>, self=0x1495250) at com.github.parnold_x.nasc.p/src/Controller.c:1292
#6  0x00007ffff70c5733 in g_task_return_now () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libgio-2.0.so.0
#7  0x00007ffff70c6543 in g_task_return () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libgio-2.0.so.0
#8  0x00000000004b0d50 in calculator_calculate_store_variable_co (_data_=0x1494560) at com.github.parnold_x.nasc.p/src/Calculator.c:3821
#9  0x00000000004b0e68 in _calculator_calculate_store_variable_co_gsource_func (self=<optimized out>) at com.github.parnold_x.nasc.p/src/Calculator.c:3778
#10 0x00007ffff7da1e39 in g_main_dispatch () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libglib-2.0.so.0
#11 0x00007ffff7da4fd7 in g_main_context_iterate_unlocked.isra () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libglib-2.0.so.0
#12 0x00007ffff7da55cc in g_main_context_iteration () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libglib-2.0.so.0
#13 0x00007ffff70f4d3d in g_application_run () from /nix/store/8mg16qnlbdxlwcxva9p228fqmbc70i4p-glib-2.80.2/lib/libgio-2.0.so.0
#14 0x00000000004c667c in nasc_nasc_app_main (args=0x7fffffffc7c8, args_length1=1) at com.github.parnold_x.nasc.p/src/Nasc.c:201
#15 0x00000000004c66a9 in main (argc=<optimized out>, argv=<optimized out>) at com.github.parnold_x.nasc.p/src/Nasc.c:209

Desktop (please complete the following information):

AlisterH commented 3 months ago

Sometimes I see this too:


 ERROR:com.github.parnold_x.nasc.p/src/Controller.c:1704:string_replace: code should not be reached
Bail out! ERROR:com.github.parnold_x.nasc.p/src/Controller.c:1704:string_replace: code should not be reached
AlisterH commented 3 months ago

OK, I've confirmed that "running on Windows 10 with WSL" is not a factor, as I can reproduce it in nixOS running on bare metal.