[binutils-gdb] gas .xstabs missing string results in a segfault
Alan Modra
amodra@sourceware.org
Thu Jan 1 21:52:44 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=682332608db2cac2c39aeb7f3b8dac61e1bc49e0
commit 682332608db2cac2c39aeb7f3b8dac61e1bc49e0
Author: Alan Modra <amodra@gmail.com>
Date: Fri Jan 2 08:21:31 2026 +1030
gas .xstabs missing string results in a segfault
Found by oss-fuzz.
* stabs.c (s_xstab): Check result of demand_copy_C_string.
(s_stab_generic): Remove duplicate warning and ignore_r_o_l
after demand_copy_C_string error.
Diff:
---
gas/stabs.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/gas/stabs.c b/gas/stabs.c
index 331a72f6753..c7797bc01e4 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -259,11 +259,7 @@ s_stab_generic (int what,
string = demand_copy_C_string (&length);
if (string == NULL)
- {
- as_warn (_(".stab%c: missing string"), what);
- ignore_rest_of_line ();
- goto out2;
- }
+ goto out2;
/* FIXME: We should probably find some other temporary storage
for string, rather than leaking memory if someone else
happens to use the notes obstack. */
@@ -402,6 +398,9 @@ s_xstab (int what)
char *stab_secname, *stabstr_secname;
stab_secname = demand_copy_C_string (&length);
+ if (stab_secname == NULL)
+ /* as_bad error has been reported. */
+ return;
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
{
More information about the Binutils-cvs
mailing list