[Bug 286443] editors/emacs: Segmentation fault when loading an old elc file in 30.1_3,3

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 22 Dec 2025 10:30:56 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=286443

Ruslan Bekenev <furyinbox@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |furyinbox@gmail.com

--- Comment #3 from Ruslan Bekenev <furyinbox@gmail.com> ---
I'm able to reproduce it with latest Emacs from ports on FreeBSD 15. 
I can also reproduce it if I build Emacs from source --with-native-comp on both
emacs30 tag and master branch. 

I also checked it on MacOS and the same issue there. Emacs is crashing with the
same set of files attached to this issue. 

The crash is happening in "get_lazy_string" function in the lread.c. 
I can't reproduce the crash if I update "comint.el" attached to this issue
with:
(load-default "comint") instead of (load-default "comint.elc"). 

Apparently having trying to load elc file isn't expected. 

I'm debugging it right now but didn't get much luck. Maybe I'll go ask in Emacs
mailing list about it, I wonder if someone there can help. 

I'll post backtrace of crash here just in case someone's curious:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x000000000070be68 in get_lazy_string (val=XIL(0x805992403)) at lread.c:3525
3525      while (str[from] != 037)
(gdb) bt
#0  0x000000000070be68 in get_lazy_string (val=XIL(0x805992403)) at
lread.c:3525
#1  0x000000000070da86 in read0 (source=0x7fffffffa900, locate_syms=false) at
lread.c:4302
#2  0x0000000000709970 in read_internal_start (stream=XIL(0x9ab0),
start=XIL(0), end=XIL(0), locate_syms=false) at lread.c:2566
#3  0x000000000070966f in Fread (stream=XIL(0x9ab0)) at lread.c:2484
#4  0x00000000006c67d8 in funcall_subr (subr=0x904860 <Sread>, numargs=1,
args=0x7fffffffab18) at eval.c:3245
#5  0x00000000006c61d9 in funcall_general (fun=XIL(0x904865), numargs=1,
args=0x7fffffffab18) at eval.c:3124
#6  0x00000000006c64d8 in Ffuncall (nargs=2, args=0x7fffffffab10) at
eval.c:3177
#7  0x0000000000708fc6 in readevalloop (readcharfun=XIL(0x9ab0),
infile0=0x7fffffffaeb0, sourcename=XIL(0x807041564), printflag=false,
readfun=XIL(0), start=XIL(0), end=XIL(0)) at lread.c:2319
#8  0x0000000000706a90 in Fload (file=XIL(0x8059ffa24), noerror=XIL(0),
nomessage=XIL(0), nosuffix=XIL(0), must_suffix=XIL(0)) at lread.c:1526
#9  0x00000000006c506b in eval_sub (form=XIL(0x8059b36f3)) at eval.c:2681
#10 0x00000000006bf8d2 in Fprogn (body=XIL(0)) at eval.c:445
#11 0x00000000006c1758 in Flet (args=XIL(0x8059b3703)) at eval.c:1193
#12 0x00000000006c4c40 in eval_sub (form=XIL(0x8059b3743)) at eval.c:2618
#13 0x00000000006bf8d2 in Fprogn (body=XIL(0)) at eval.c:445
#14 0x00000000006c733c in funcall_lambda (fun=XIL(0x807040abd), nargs=1,
arg_vector=0x7fffffffb360) at eval.c:3434
#15 0x00000000006c6cc0 in apply_lambda (fun=XIL(0x807040abd),
args=XIL(0x8059b30b3), count=...) at eval.c:3299
#16 0x00000000006c51ca in eval_sub (form=XIL(0x8059b30c3)) at eval.c:2714
#17 0x00000000007090fa in readevalloop (readcharfun=XIL(0x9a50),
infile0=0x7fffffffb8e0, sourcename=XIL(0x8059ff1e4), printflag=false,
readfun=XIL(0), start=XIL(0), end=XIL(0)) at lread.c:2341
#18 0x0000000000706b0f in Fload (file=XIL(0x8059fe884), noerror=XIL(0),
nomessage=XIL(0x30), nosuffix=XIL(0), must_suffix=XIL(0x30)) at lread.c:1533
#19 0x0000000000706d1b in save_match_data_load (file=XIL(0x8059fe884),
noerror=XIL(0), nomessage=XIL(0x30), nosuffix=XIL(0), must_suffix=XIL(0x30)) at
lread.c:1578
#20 0x00000000006c4360 in load_with_autoload_queue (file=XIL(0x8059fe884),
noerror=XIL(0), nomessage=XIL(0x30), nosuffix=XIL(0), must_suffix=XIL(0x30)) at
eval.c:2448
#21 0x00000000006d9dae in Frequire (feature=XIL(0x8050795a0), filename=XIL(0),
noerror=XIL(0)) at fns.c:3799
#22 0x00000000006c6832 in funcall_subr (subr=0x902be0 <Srequire>, numargs=1,
args=0x807282248) at eval.c:3249
#23 0x000000000072463e in exec_byte_code (fun=XIL(0x8070cd7d5),
args_template=0, nargs=0, args=0x0) at bytecode.c:822
#24 0x00000000007236f4 in Fbyte_code (bytestr=XIL(0x8059fe8a4),
vector=XIL(0x807040add), maxdepth=make_fixnum(8)) at bytecode.c:319
#25 0x00000000006c4feb in eval_sub (form=XIL(0x8059b31c3)) at eval.c:2673
#26 0x00000000007090fa in readevalloop (readcharfun=XIL(0x9ab0),
infile0=0x7fffffffc600, sourcename=XIL(0x805880724), printflag=false,
readfun=XIL(0), start=XIL(0), end=XIL(0)) at lread.c:2341
#27 0x0000000000706a90 in Fload (file=XIL(0x80587ed84), noerror=XIL(0),
nomessage=XIL(0), nosuffix=XIL(0), must_suffix=XIL(0)) at lread.c:1526
#28 0x00000000006c68b6 in funcall_subr (subr=0x9046e0 <Sload>, numargs=1,
args=0x807282218) at eval.c:3253
#29 0x000000000072463e in exec_byte_code (fun=XIL(0x80665ecb5),
args_template=257, nargs=1, args=0x7fffffffccd8) at bytecode.c:822
#30 0x00000000006c6e29 in funcall_lambda (fun=XIL(0x80665ecb5), nargs=1,
arg_vector=0x7fffffffccd0) at eval.c:3336
#31 0x00000000006c6cc0 in apply_lambda (fun=XIL(0x80665ecb5),
args=XIL(0x8059b32f3), count=...) at eval.c:3299
#32 0x00000000006c51ca in eval_sub (form=XIL(0x8059b3303)) at eval.c:2714
#33 0x0000000000708858 in readevalloop_eager_expand_eval (val=XIL(0x8059b3303),
macroexpand=XIL(0xb670)) at lread.c:2152
#34 0x00000000007090e8 in readevalloop (readcharfun=XIL(0x80706259d),
infile0=0x0, sourcename=XIL(0x807087704), printflag=false, readfun=XIL(0),
start=XIL(0), end=XIL(0)) at lread.c:2339
#35 0x000000000070944e in Feval_buffer (buffer=XIL(0x80706259d),
printflag=XIL(0), filename=XIL(0x807087704), unibyte=XIL(0),
do_allow_print=XIL(0x30)) at lread.c:2418
#36 0x00000000006c68b6 in funcall_subr (subr=0x9047a0 <Seval_buffer>,
numargs=5, args=0x8072821c0) at eval.c:3253
#37 0x000000000072463e in exec_byte_code (fun=XIL(0x8060b93ad),
args_template=257, nargs=1, args=0x8072821c8) at bytecode.c:822
#38 0x00000000006c6e29 in funcall_lambda (fun=XIL(0x8064193a5), nargs=4,
arg_vector=0x7fffffffd928) at eval.c:3336
#39 0x00000000006c6225 in funcall_general (fun=XIL(0x8064193a5), numargs=4,
args=0x7fffffffd928) at eval.c:3128
#40 0x00000000006c64d8 in Ffuncall (nargs=5, args=0x7fffffffd920) at
eval.c:3177
#41 0x00000000007066fa in Fload (file=XIL(0x807087464), noerror=XIL(0),
nomessage=XIL(0x30), nosuffix=XIL(0), must_suffix=XIL(0)) at lread.c:1414
#42 0x00000000006c68b6 in funcall_subr (subr=0x9046e0 <Sload>, numargs=3,
args=0x8072820e0) at eval.c:3253
#43 0x000000000072463e in exec_byte_code (fun=XIL(0x80668ba2d),
args_template=769, nargs=3, args=0x8072823d0) at bytecode.c:822
#44 0x00000000006c6e29 in funcall_lambda (fun=XIL(0x8066eae15), nargs=0,
arg_vector=0x7fffffffe170) at eval.c:3336
#45 0x00000000006c6cc0 in apply_lambda (fun=XIL(0x8066eae15), args=XIL(0),
count=...) at eval.c:3299
#46 0x00000000006c51ca in eval_sub (form=XIL(0x8068da633)) at eval.c:2714
#47 0x00000000006c46f0 in Feval (form=XIL(0x8068da633), lexical=XIL(0x30)) at
eval.c:2528
#48 0x00000000005e13bf in top_level_2 () at keyboard.c:1179
#49 0x00000000006c270c in internal_condition_case (bfun=0x5e1358 <top_level_2>,
handlers=XIL(0x90), hfun=0x5e0c2a <cmd_error>) at eval.c:1690
#50 0x00000000005e141a in top_level_1 (ignore=XIL(0)) at keyboard.c:1191
#51 0x00000000006c1bad in internal_catch (tag=XIL(0x127b0), func=0x5e13d8
<top_level_1>, arg=XIL(0)) at eval.c:1370
#52 0x00000000005e12a0 in command_loop () at keyboard.c:1140
#53 0x00000000005e0703 in recursive_edit_1 () at keyboard.c:749
#54 0x00000000005e0916 in Frecursive_edit () at keyboard.c:832
#55 0x00000000005dbead in main (argc=7, argv=0x7fffffffe6d0) at emacs.c:2629

Lisp Backtrace:
"read" (0xffffab18)
"load" (0xffffafc0)
"let" (0xffffb230)
"load-default" (0xffffb360)
"require" (0x7282248)
"byte-code" (0xffffc160)
"load" (0x7282218)
"load-library" (0xffffccd0)
"eval-buffer" (0x72821c0)
"load-with-code-conversion" (0xffffd928)
"load" (0x72820e0)
"command-line-1" (0x7281fe8)
"command-line" (0x7281f70)
"normal-top-level" (0xffffe170)

-- 
You are receiving this mail because:
You are the assignee for the bug.