[binutils-gdb] gas totalfrags
Alan Modra
amodra@sourceware.org
Wed Jan 1 12:26:18 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1d2becbb32224902e8a310b478461dd61f9c9193
commit 1d2becbb32224902e8a310b478461dd61f9c9193
Author: Alan Modra <amodra@gmail.com>
Date: Wed Jan 1 22:38:03 2025 +1030
gas totalfrags
Avoid any possibility of signed overflow. (Seen on oss-fuzz).
* frags.c (totalfrags): Make unsigned.
(get_frag_count): Return unsigned.
* frags.h (get_frag_count): Likewise.
Diff:
---
gas/frags.c | 4 ++--
gas/frags.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/gas/frags.c b/gas/frags.c
index c154a5a2b7e..a57a4d56187 100644
--- a/gas/frags.c
+++ b/gas/frags.c
@@ -25,9 +25,9 @@
extern fragS zero_address_frag;
extern fragS predefined_address_frag;
-static int totalfrags;
+static unsigned int totalfrags;
-int
+unsigned int
get_frag_count (void)
{
return totalfrags;
diff --git a/gas/frags.h b/gas/frags.h
index e71a407ecca..a1dcea0be0c 100644
--- a/gas/frags.h
+++ b/gas/frags.h
@@ -155,7 +155,7 @@ bool frag_offset_fixed_p (const fragS *, const fragS *, offsetT *);
bool frag_offset_ignore_align_p (const fragS *, const fragS *, offsetT *);
bool frag_gtoffset_p (valueT, const fragS *, valueT, const fragS *, offsetT *);
-int get_frag_count (void);
+unsigned int get_frag_count (void);
void clear_frag_count (void);
#endif /* FRAGS_H */
More information about the Binutils-cvs
mailing list