Mesa (master): draw: Fix an off-by-one bug in a vsplit assertion.

Chia-I Wu olv at kemper.freedesktop.org
Thu Jan 13 18:04:19 UTC 2011


Module: Mesa
Branch: master
Commit: abbb1c8f084c6739bc9d6f559caf26f3f71b2fab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=abbb1c8f084c6739bc9d6f559caf26f3f71b2fab

Author: Chia-I Wu <olv at lunarg.com>
Date:   Fri Jan 14 01:50:51 2011 +0800

draw: Fix an off-by-one bug in a vsplit assertion.

When use_spoken is true, istart (the first vertex of this segment) is
replaced by i0 (the spoken vertex of the fan).  There are still icount
vertices.

Thanks to Brian Paul for spotting this.

---

 src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
index 3f66f96..75dba8c 100644
--- a/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
+++ b/src/gallium/auxiliary/draw/draw_pt_vsplit_tmp.h
@@ -258,9 +258,10 @@ vsplit_segment_fan_linear(struct vsplit_frontend *vsplit, unsigned flags,
    boolean use_spoken = ((flags & DRAW_SPLIT_BEFORE) != 0);
    unsigned nr = 0, i;
 
-   assert(icount + !!use_spoken <= vsplit->segment_size);
+   assert(icount <= vsplit->segment_size);
 
    if (use_spoken) {
+      /* replace istart by i0 */
       vsplit->fetch_elts[nr++] = i0;
       for (i = 1 ; i < icount; i++)
          vsplit->fetch_elts[nr++] = istart + i;




More information about the mesa-commit mailing list