summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-01-18 22:35:19 +0100
committerMarek Olšák <[email protected]>2017-01-19 16:38:37 +0100
commit9e4d1d8a7c0d60a6975d186944cd870e06f94773 (patch)
tree3502ec2b645df01353014059388682a8fcef3cf9
parente490b7812cae778c61004971d86dc8299b6cd240 (diff)
radeonsi: reject invalid vertex element formats
This should fix a coverity defect. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]>
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 876cbf6a34b..4a9ca812174 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -3366,6 +3366,11 @@ static void *si_create_vertex_elements(struct pipe_context *ctx,
desc = util_format_description(elements[i].src_format);
first_non_void = util_format_get_first_non_void_channel(elements[i].src_format);
+ if (first_non_void < 0) {
+ FREE(v);
+ return NULL;
+ }
+
data_format = si_translate_buffer_dataformat(ctx->screen, desc, first_non_void);
num_format = si_translate_buffer_numformat(ctx->screen, desc, first_non_void);
channel = &desc->channel[first_non_void];