summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-07-04 09:59:43 -0600
committerBrian Paul <brian.paul@tungstengraphics.com>2008-07-04 10:02:43 -0600
commitba9e6339028c36269cb50bb8535e415fa8e6e4c9 (patch)
treec7b991048b99d30566278c3908785d5f5f839da8
parent294b061256220960e7e29fbc8ecbd2ffce75de40 (diff)
gallium: fix trim() function bug when count < first
If the user called glDrawArrays(GL_TRIANGLES, count=1), trim() returned a very large integer because of the unsigned arithmetic.
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 9140faeea9..85a75525c8 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -37,6 +37,8 @@
static unsigned trim( unsigned count, unsigned first, unsigned incr )
{
+ if (count < first)
+ return 0;
return count - (count - first) % incr;
}