bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Off by one error sweeping vtable relocs


From: Nick Clifton
Subject: Off by one error sweeping vtable relocs
Date: 31 Aug 2001 17:10:42 +0100

Hi Guys,

  I recently discovered an off by one error in
  elf_gc_propogate_vtable_entries_used().  The function computes 'n',
  the number of entries in the parent's vtable, but it then indexes
  whilst --n is non zero.  This will count one less than n iterations
  which is wrong.  The patch below fixes this.

Cheers
        Nick

2001-08-31  Nick Clifton  <address@hidden>

        * elflink.h (elf_gc_propagate_vtable_entries_used): Fix off-by-one
        error.

Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.103
diff -p -r1.103 elflink.h
*** elflink.h   2001/08/24 16:36:04     1.103
--- elflink.h   2001/08/31 15:54:38
*************** elf_gc_propagate_vtable_entries_used (h,
*** 7101,7110 ****
            int file_align = bed->s->file_align;
  
          n = h->vtable_parent->vtable_entries_size / file_align;
!         while (--n != 0)
            {
!             if (*pu) *cu = true;
!             pu++, cu++;
            }
        }
      }
--- 7101,7112 ----
            int file_align = bed->s->file_align;
  
          n = h->vtable_parent->vtable_entries_size / file_align;
!         while (n--)
            {
!             if (*pu)
!               *cu = true;
!             pu++;
!             cu++;
            }
        }
      }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]