]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
hashcode-mem: don’t infloop if UINT_MAX < size
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 26 Jun 2026 18:28:58 +0000 (11:28 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 26 Jun 2026 21:34:58 +0000 (14:34 -0700)
* lib/hashcode-mem.c (hash_pjw_bare): Use size_t for loop index.

ChangeLog
lib/hashcode-mem.c

index 11744aeb9df48b3159a8b86ebedc77c8a339a261..03575cf89bc29930f21f22c68d24983d370b0b0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2026-06-26  Paul Eggert  <eggert@cs.ucla.edu>
 
+       hashcode-mem: don’t infloop if UINT_MAX < size
+       * lib/hashcode-mem.c (hash_pjw_bare): Use size_t for loop index.
+
        gen-uni-tables: prefer size_t for size loops
        * lib/gen-uni-tables.c (output_predicate, output_category)
        (output_combclass, output_bidi_category, output_decimal_digit)
index a4963afb686a4a6ed7b8e7dd907ff76aaf1e4f7c..30ee835107386768273de1c6b83dfe9b1bb70386 100644 (file)
@@ -34,7 +34,7 @@ hash_pjw_bare (const void *x, size_t n)
   const unsigned char *s = x;
   size_t h = 0;
 
-  for (unsigned int i = 0; i < n; i++)
+  for (size_t i = 0; i < n; i++)
     h = s[i] + stdc_rotate_left (h, 9);
 
   return h;