From ba9e6339028c36269cb50bb8535e415fa8e6e4c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Jul 2008 09:59:43 -0600 Subject: 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. --- src/gallium/auxiliary/draw/draw_pt.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gallium') 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; } -- cgit v1.2.3