• Brian Paul's avatar
    gallium/vbuf: avoid segfault when we get invalid glDrawRangeElements() · ccf9de7a
    Brian Paul authored
    A common user error is to call glDrawRangeElements() with the 'end'
    argument being one too large.  If we use the vbuf module to translate
    some vertex attributes this error can cause us to read past the end of
    the mapped hardware buffer, resulting in a crash.
    
    This patch adjusts the vertex count to avoid that issue.  Typically,
    the vertex_count gets decremented by one.
    
    This fixes crashes with the Unigine Tropics and Sanctuary demos with older
    VMware hardware versions.  The issue isn't hit with VGPU10 because we
    don't hit this fallback.
    
    No piglit changes.
    
    CC: mesa-stable@lists.freedesktop.org
    Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
    (cherry picked from commit d8148ed1)
    [Andres Gomez: pipe_vertex_buffer hadn't shrunk yet]
    Signed-off-by: Andres Gomez's avatarAndres Gomez <agomez@igalia.com>
    
    Conflicts:
    	src/gallium/auxiliary/util/u_vbuf.c
    ccf9de7a
u_vbuf.c 47.3 KB