URL: <https://savannah.gnu.org/bugs/?68468>
Summary: [eqn] SEGV when more than 9 arguments passed to a
user-defined eqn macro
Group: GNU roff
Submitter: gbranden
Submitted: Tue 23 Jun 2026 06:51:53 PM UTC
Category: Preprocessor eqn
Severity: 4 - Important
Item Group: Crash/Unresponsive
Status: In Progress
Privacy: Public
Assigned to: gbranden
Open/Closed: Open
Discussion Lock: Unlocked
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 23 Jun 2026 06:51:53 PM UTC By: G. Branden Robinson <gbranden>
I don't get this crash with a "stock" build, and a "hardened" one such as that
distributed by Debian might not have any trouble with it, but I can elicit it
with my "paranoid" suite of compiler options.
$ cat ATTIC/eqn-too-many-macro-arguments.ms
.LP
This is my
.I "groff ms"
document.
.EQ
define derp ! $1 + $2 + $3 + $4 + $5 + $6 + $7 + $8 + $9 !
addup derp(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
.EN
$ ~/groff-1.24.1/bin/groff -e -ms ATTIC/eqn-too-many-macro-arguments.ms >|
ATTIC/eqn-too-many-macro-arguments.ps && echo SUCCESS
SUCCESS
$ ./build/test-groff -e -ms ATTIC/eqn-too-many-macro-arguments.ms >|
ATTIC/eqn-too-many-macro-arguments.ps && echo SUCCESS
/home/branden/src/GIT/groff/build/groff: error: eqn: Illegal instruction (core
dumped)
$ gdb ./build/eqn ./core
GNU gdb (Debian 10.1-1.7) 10.1.90.20210103-git
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./build/eqn...
[New LWP 62001]
Core was generated by `eqn -Tps ATTIC/eqn-too-many-macro-arguments.ms'.
Program terminated with signal SIGILL, Illegal instruction.
#0 0x000055d01d891a5b in interpolate_macro_with_args (body=0x55d041e50760 "
$1 + $2 + $3 + $4 + $5 + $6 + $7 + $8 + $9 ")
at ../src/preproc/eqn/lex.cpp:775
775 argv[argc] = strsave(token_buffer.contents());
##(gdb) bt
#0 0x000055d01d891a5b in interpolate_macro_with_args (body=0x55d041e50760 "
$1 + $2 + $3 + $4 + $5 + $6 + $7 + $8 + $9 ")
at ../src/preproc/eqn/lex.cpp:775
#1 0x000055d01d8991ac in get_token (lookup_flag=lookup_flag@entry=1) at
../src/preproc/eqn/lex.cpp:861
#2 0x000055d01d89c310 in yylex () at ../src/preproc/eqn/lex.cpp:1183
#3 0x000055d01d8a4e56 in yyparse () at src/preproc/eqn/eqn.cpp:1401
#4 0x000055d01d89a9e2 in do_file (fp=fp@entry=0x55d041e507e0,
filename=<optimized out>) at ../src/preproc/eqn/main.cpp:155
#5 0x000055d01d89b44b in main (argc=3, argv=0x7ffdeb640448) at
../src/preproc/eqn/main.cpp:494
Fix this.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68468>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
