[binutils-gdb] gas: range-check 3rd argument of .align et al
Jan Beulich
jbeulich@sourceware.org
Fri May 16 08:40:09 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=344b1e0f5f7900da0087fee1704dd98fd30ea4c4
commit 344b1e0f5f7900da0087fee1704dd98fd30ea4c4
Author: Jan Beulich <jbeulich@suse.com>
Date: Fri May 16 10:37:46 2025 +0200
gas: range-check 3rd argument of .align et al
Negative values would have been silently converted to large positive
ones, which may not be the user's intention. Similarly overly large
values would have been silently truncated. Warn them instead, and zap
such values.
Diff:
---
gas/read.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gas/read.c b/gas/read.c
index 31b89b7cbc8..0b817b790a1 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -1598,7 +1598,13 @@ s_align (signed int arg, int bytes_p)
else
{
++input_line_pointer;
- max = get_absolute_expression ();
+ offsetT val = get_absolute_expression ();
+ max = val;
+ if (val < 0 || max != val)
+ {
+ as_warn (_("ignoring out of range alignment maximum"));
+ max = 0;
+ }
}
}
More information about the Binutils-cvs
mailing list