public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Prevent the ASCII linker script directive from generating huge amounts of padding if the size expres
@ 2023-03-03 13:57 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-03-03 13:57 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=adbe951fc95943016325af08d677f18e8c177ac1

commit adbe951fc95943016325af08d677f18e8c177ac1
Author: Nick Clifton <nickc@redhat.com>
Date:   Fri Mar 3 13:56:36 2023 +0000

    Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant.
    
     PR 30193 * ldgram.y (ASCII): Fail if the size is not a constant.

Diff:
---
 ld/ChangeLog | 5 +++++
 ld/ldgram.y  | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9f4ad7cbf25..6a7bc06c70c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2023-03-03  Nick Clifton  <nickc@redhat.com>
+
+	PR 30193
+	* ldgram.y (ASCII): Fail if the size is not a constant.
+
 2023-02-23  Fangrui Song  <i@maskray.me>
 
 	* emultempl/riscvelf.em: Add option parsing.
diff --git a/ld/ldgram.y b/ld/ldgram.y
index faffeec94b8..26e56fe1566 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -672,7 +672,10 @@ statement:
 		{
 		  /* 'value' is a memory leak, do we care?  */
 		  etree_type *value = $3;
-		  lang_add_string (value->value.value, $5);
+		  if (value->type.node_code == INT)
+		    lang_add_string (value->value.value, $5);
+		  else
+		    einfo (_("%X%P:%pS: ASCII expression must be an integer\n"), NULL);
 		}
 	| ASCIZ NAME
 		{

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-03 13:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 13:57 [binutils-gdb] Prevent the ASCII linker script directive from generating huge amounts of padding if the size expres Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).