translate: deal with size overflows by casting to ptrdiff_t
authorIlia Mirkin <imirkin@alum.mit.edu>
Wed, 22 Jan 2014 00:45:18 +0000 (19:45 -0500)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Mon, 27 Jan 2014 15:40:42 +0000 (16:40 +0100)
commit3de97ce9200e9fe96891e7e92ec83f0fc38d8693
tree3a8a1c9694b29764b769badfadc9290c3ebab693
parent4dd445f1cf80292f10eda53665cefc2a674d838d
translate: deal with size overflows by casting to ptrdiff_t

This was discovered as a result of the draw-elements-base-vertex-neg
piglit test, which passes very negative offsets in, followed up by large
indices. The nouveau code correctly adjusts the pointer, but the
translate code needs to do the proper inverse correction. Similarly fix
up the SSE code to do a 64-bit multiply to compute the proper offset.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/translate/translate_generic.c
src/gallium/auxiliary/translate/translate_sse.c