st/mesa: fix a possible crash with selection and feedback modes
authorMarek Olšák <marek.olsak@amd.com>
Wed, 12 Feb 2020 22:15:34 +0000 (17:15 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 10 Mar 2020 01:26:55 +0000 (21:26 -0400)
The index bounds are always valid without an index buffer, but they won't be.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3986>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3986>

src/mesa/state_tracker/st_draw_feedback.c

index 44b7b1e8547e10cb28df99efff25026a4c2cdfc7..47e43f856d53e98d700d1e0d3e3ea8e6c3ec0bd6 100644 (file)
@@ -134,7 +134,7 @@ st_feedback_draw_vbo(struct gl_context *ctx,
 
    st_validate_state(st, ST_PIPELINE_RENDER);
 
-   if (!index_bounds_valid)
+   if (ib && !index_bounds_valid)
       vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, nr_prims);
 
    /* must get these after state validation! */