diff options
author | Zack Rusin <[email protected]> | 2013-06-25 17:01:14 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-06-28 04:24:20 -0400 |
commit | 88de009cc1ab838cd87416dcbbaa4f5b30173c71 (patch) | |
tree | 6f07591ed07dc76c7a202d90252f280cb6b6ec66 /src/gallium/auxiliary/draw/draw_pt.c | |
parent | 2f13f28120fdfe2f5a64e87b4ec19db94bf63713 (diff) |
draw: check for integer overflows in instance computation
Integers could easily overflow is the starting instance
was large enough. Instead of letting bogus counts through
set the instance to max if it overflown and let our
regular buffer overflow computation handle it.
Signed-off-by: Zack Rusin <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pt.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index e0b8007a4f5..c4d06de84bb 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -533,6 +533,12 @@ draw_vbo(struct draw_context *draw, for (instance = 0; instance < info->instance_count; instance++) { draw->instance_id = instance + info->start_instance; + /* check for overflow */ + if (draw->instance_id < instance || + draw->instance_id < info->start_instance) { + /* if we overflown just set the instance id to the max */ + draw->instance_id = 0xffffffff; + } draw_new_instance(draw); |