[Mesa-dev] [PATCH] nvc0: handle possible null dereference in nvc0_validate_vertex_buffers
Rhys Perry
pendingchaos02 at gmail.com
Mon Oct 8 16:20:19 UTC 2018
It's valid to have a vertex buffer with a NULL resource.
Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
---
src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
index 66de6d9e2f..7871d50ab9 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_vbo.c
@@ -346,6 +346,10 @@ nvc0_validate_vertex_buffers(struct nvc0_context *nvc0)
/* address/value set in nvc0_update_user_vbufs */
continue;
}
+ if (!vb->buffer.resource) {
+ IMMED_NVC0(push, NVC0_3D(VERTEX_ARRAY_FETCH(i)), 0);
+ continue;
+ }
res = nv04_resource(vb->buffer.resource);
offset = ve->pipe.src_offset + vb->buffer_offset;
limit = vb->buffer.resource->width0 - 1;
--
2.17.1
More information about the mesa-dev
mailing list