aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-07-04 09:59:43 -0600
committerBrian Paul <[email protected]>2008-07-04 10:02:43 -0600
commitba9e6339028c36269cb50bb8535e415fa8e6e4c9 (patch)
treec7b991048b99d30566278c3908785d5f5f839da8 /src/gallium
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.
Diffstat (limited to 'src/gallium')
-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 9140faeea9d..85a75525c8b 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;
}