]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 34418 alpha_vms_slurp_relocs off-by-one section index check
authorAlan Modra <amodra@gmail.com>
Wed, 22 Jul 2026 08:50:37 +0000 (18:20 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 22 Jul 2026 08:50:37 +0000 (18:20 +0930)
* vms-alpha.c (alpha_vms_slurp_relocs): Make cur_psect unsigned.
Correct cur_psect bounds check.

bfd/vms-alpha.c

index 24b05f90beaaebd18195a2c0d4299cfb401c581f..d07660df0a74cdb383201ab803cd8bf1afc46eb4 100644 (file)
@@ -5281,7 +5281,7 @@ alpha_vms_canonicalize_symtab (bfd *abfd, asymbol **symbols)
 static bool
 alpha_vms_slurp_relocs (bfd *abfd)
 {
-  int cur_psect = -1;
+  unsigned int cur_psect = -1u;
 
   vms_debug2 ((3, "alpha_vms_slurp_relocs\n"));
 
@@ -5525,7 +5525,7 @@ alpha_vms_slurp_relocs (bfd *abfd)
            bfd_size_type size;
 
            /* Get section to which the relocation applies.  */
-           if (cur_psect < 0 || cur_psect > (int)PRIV (section_count))
+           if (cur_psect >= PRIV (section_count))
              {
                _bfd_error_handler (_("invalid section index in ETIR"));
                goto fail;