summaryrefslogtreecommitdiff
path: root/ld/ldgram.y
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-03-03 13:56:36 +0000
committerNick Clifton <nickc@redhat.com>2023-03-03 13:56:36 +0000
commitadbe951fc95943016325af08d677f18e8c177ac1 (patch)
tree6f2e0031aab67fa63ea904a65470e025688d6578 /ld/ldgram.y
parent6a208145d24c47912c8beb4f1f4b9abeb8d51134 (diff)
downloadbinutils-gdb-adbe951fc95943016325af08d677f18e8c177ac1.tar.gz
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.
Diffstat (limited to 'ld/ldgram.y')
-rw-r--r--ld/ldgram.y5
1 files changed, 4 insertions, 1 deletions
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
{