swrast: Fix unsigned promotion in pointer arithmetic
authorChad Versace <chad.versace@linux.intel.com>
Wed, 18 Jan 2012 23:56:58 +0000 (15:56 -0800)
committerChad Versace <chad.versace@linux.intel.com>
Tue, 24 Jan 2012 01:44:52 +0000 (17:44 -0800)
commitaed5c8299fe47b8e1728f8140d069bc89d3fa947
tree4b1e18830b2e00dcbd9dda73f6967b7f88115ee6
parentb48d4b64e97f48dcf0aef1b6f7bc333c309cc183
swrast: Fix unsigned promotion in pointer arithmetic

When rowstride was negatie, unsigned promotion caused a segfault here:

299│    if (rb->Format == MESA_FORMAT_S8) {
300│       const GLuint rowStride = rb->RowStride;
301│       for (i = 0; i < count; i++) {
302│          if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) {
303├>            stencil[i] = *(map + y[i] * rowStride + x[i]);
304│          }
305│       }
306│    }

Fixes segfault in oglconform
separatestencil-neu(NonPolygon.BothFacesBitmapCoreAPI),
though test still fails.

Note: This is a candidate for the stable branches.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43327
Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
src/mesa/swrast/s_stencil.c