aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-07-02 00:02:33 +0930
committerAlan Modra <amodra@gmail.com>2024-07-03 15:37:35 +0930
commit5b714f5b6dfd5b56e84daf57d302173253aa4495 (patch)
tree0ea305eeb9dfad34ed59a3260a481d0825acb7bf /gas
parentaa8c6e648460f99f38cbecffc0e3763f0a4f768d (diff)
downloadbinutils-5b714f5b6dfd5b56e84daf57d302173253aa4495.zip
binutils-5b714f5b6dfd5b56e84daf57d302173253aa4495.tar.gz
binutils-5b714f5b6dfd5b56e84daf57d302173253aa4495.tar.bz2
Avoid possible signed overflow in decode_local_label_name
Matches what both fb_label_name and dollar_label_name use. * symbols.c (decode_local_label_name): Use unsigned variables.
Diffstat (limited to 'gas')
-rw-r--r--gas/symbols.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gas/symbols.c b/gas/symbols.c
index b57dbfc..fa3aaa37 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -2185,11 +2185,11 @@ decode_local_label_name (char *s)
{
char *p;
char *symbol_decode;
- int label_number;
- int instance_number;
+ unsigned int label_number;
+ unsigned int instance_number;
const char *type;
const char *message_format;
- int lindex = 0;
+ unsigned int lindex = 0;
#ifdef LOCAL_LABEL_PREFIX
if (s[lindex] == LOCAL_LABEL_PREFIX)
@@ -2212,7 +2212,7 @@ decode_local_label_name (char *s)
for (instance_number = 0, p++; ISDIGIT (*p); ++p)
instance_number = (10 * instance_number) + *p - '0';
- message_format = _("\"%d\" (instance number %d of a %s label)");
+ message_format = _("\"%u\" (instance number %u of a %s label)");
symbol_decode = notes_alloc (strlen (message_format) + 30);
sprintf (symbol_decode, message_format, label_number, instance_number, type);