[virglrenderer-devel] [PATCH] renderer: check for shader_text validity

Po-Hsien Wang pwang at chromium.org
Thu Jul 26 02:43:48 UTC 2018


Add a check for nonterminated string passed into the create_shader
code.
---
 src/vrend_renderer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index da24f04..610e796 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -2675,6 +2675,9 @@ int vrend_create_shader(struct vrend_context *ctx,
    bool finished = false;
    int ret;
 
+   if (length <= 0 || shd_text[length - 1] != '\0')
+      return EINVAL;
+
    if (type > PIPE_SHADER_TESS_EVAL)
       return EINVAL;
 
-- 
2.18.0.345.g5c9ce644c3-goog



More information about the virglrenderer-devel mailing list