From: Paul Eggert Date: Mon, 11 Jul 2011 18:36:33 +0000 (-0700) Subject: * dispnew.c (init_display): Use *_RANGE_OVERFLOW macros. X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~163 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e3c25c689524aa85ce37840fff344cc297cf42ec;p=emacs.git * dispnew.c (init_display): Use *_RANGE_OVERFLOW macros. The plain *_OVERFLOW macros run afoul of GCC bug 49705 and therefore cause GCC to emit a bogus diagnostic in some cases. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4e69399154d..c519100b2f0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2011-07-11 Paul Eggert + * dispnew.c (init_display): Use *_RANGE_OVERFLOW macros. + The plain *_OVERFLOW macros run afoul of GCC bug 49705 + + and therefore cause GCC to emit a bogus diagnostic in some cases. + * image.c: Integer signedness and overflow and related fixes. This is not an exhaustive set of fixes, but it's time to record what I've got. diff --git a/src/dispnew.c b/src/dispnew.c index 15d80367701..d52bbdf1d3e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6298,8 +6298,8 @@ init_display (void) change. It's not clear what better we could do. The rest of the code assumes that (width + 2) * height * sizeof (struct glyph) does not overflow and does not exceed PTRDIFF_MAX or SIZE_MAX. */ - if (INT_ADD_OVERFLOW (width, 2) - || INT_MULTIPLY_OVERFLOW (width + 2, height) + if (INT_ADD_RANGE_OVERFLOW (width, 2, INT_MIN, INT_MAX) + || INT_MULTIPLY_RANGE_OVERFLOW (width + 2, height, INT_MIN, INT_MAX) || (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (struct glyph) < (width + 2) * height)) fatal ("screen size %dx%d too big", width, height);