From 3193c2cbabf440dc8d0a6d59ee630e7ad0813d67 Mon Sep 17 00:00:00 2001 From: Po-Hsien Wang Date: Wed, 25 Jul 2018 19:43:48 -0700 Subject: [PATCH] renderer: check for shader_text validity Add a check for nonterminated string passed into the create_shader code. No point checking len <= 0, since it's a uint32_t. Signed-off-by: Dave Airlie --- src/vrend_renderer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 7c70b50..0f05168 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -2929,6 +2929,9 @@ int vrend_create_shader(struct vrend_context *ctx, bool finished = false; int ret; + if (pkt_length == 0 || shd_text[pkt_length - 1] != '\0') + return EINVAL; + if (type > PIPE_SHADER_COMPUTE) return EINVAL;