From: Matthew Wala Date: Wed, 30 Nov 2011 00:44:15 +0000 (+0100) Subject: Avoid subtracting two pointers that don't point into the same block. X-Git-Tag: v0.1~1391 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=ec2348da1754e807233e33beefdb732a119e4adc;p=gnulib.git Avoid subtracting two pointers that don't point into the same block. * lib/argp-help.c (hol_append): Reorder pointer subtractions so that only pointers into the same memory block are subtracted. We cannot assume that sizeof (ptrdiff_t) == sizeof (void *). --- diff --git a/ChangeLog b/ChangeLog index 9735aa876..66a54f004 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-11-29 Matthew Wala (tiny change) + + Avoid subtracting two pointers that don't point into the same block. + * lib/argp-help.c (hol_append): Reorder pointer subtractions so that + only pointers into the same memory block are subtracted. We cannot + assume that sizeof (ptrdiff_t) == sizeof (void *). + 2011-11-29 Eric Blake maint.mk: add syntax check for use of compare from init.sh diff --git a/lib/argp-help.c b/lib/argp-help.c index 0cc583858..ec7fcda60 100644 --- a/lib/argp-help.c +++ b/lib/argp-help.c @@ -891,7 +891,8 @@ hol_append (struct hol *hol, struct hol *more) /* Fix up the short options pointers from HOL. */ for (e = entries, left = hol->num_entries; left > 0; e++, left--) - e->short_options += (short_options - hol->short_options); + e->short_options = + short_options + (e->short_options - hol->short_options); /* Now add the short options from MORE, fixing up its entries too. */