aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-01-01 22:38:03 +1030
committerAlan Modra <amodra@gmail.com>2025-01-01 22:38:03 +1030
commit1d2becbb32224902e8a310b478461dd61f9c9193 (patch)
tree6010b3eb64b6926922eb8aa9c879d95ec6c98b1e /gas
parentb38cf91f230bc3892ab9c3deb4f1b6639c657c47 (diff)
downloadgdb-1d2becbb32224902e8a310b478461dd61f9c9193.zip
gdb-1d2becbb32224902e8a310b478461dd61f9c9193.tar.gz
gdb-1d2becbb32224902e8a310b478461dd61f9c9193.tar.bz2
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/frags.c4
-rw-r--r--gas/frags.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/gas/frags.c b/gas/frags.c
index c154a5a..a57a4d5 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 e71a407..a1dcea0 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 */