x
Alan Modra
amodra@gmail.com
Mon Jan 18 00:28:17 GMT 2021
>From 047fc1a199fd859df6f662f7ce47cf1e7bdf4e4d Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Mon, 18 Jan 2021 09:38:22 +1030
Subject: PR27198, segv in S_IS_WEAK
This erroneous input
call (%rax)printf
results in a NULL dereference.
A nicer fix might be to parse "call (%rax)junk" as "call (%rax)" which
is a variant of "call *%rax" missing the explicit indirection and with
some extra parentheses, but I figure it's not worth bothering.
OK?
PR 27198
* config/tc-i386.c (need_plt32_p): Return FALSE for NULL symbol.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index a7d2ff1c1f9..b0140e1128a 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -8628,6 +8628,9 @@ need_plt32_p (symbolS *s)
if (!object_64bit)
return FALSE;
+ if (s == NULL)
+ return FALSE;
+
/* Weak or undefined symbol need PLT32 relocation. */
if (S_IS_WEAK (s) || !S_IS_DEFINED (s))
return TRUE;
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list