Skip to content
  • Brian Paul's avatar
    gallium/vbuf: avoid segfault when we get invalid glDrawRangeElements() · d8148ed1
    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>
    d8148ed1