---
 src/mesa/main/program_binary.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/mesa/main/program_binary.c b/src/mesa/main/program_binary.c
index 2786487362..68a15ec258 100644
--- a/src/mesa/main/program_binary.c
+++ b/src/mesa/main/program_binary.c
@@ -287,5 +287,19 @@ _mesa_program_binary(struct gl_context *ctx, struct 
gl_shader_program *sh_prog,
       return;
    }
 
+   if (blob.current != blob.end || blob.overrun) {
+      /* Something has gone wrong ignore the binary and set link status to
+       * failure.
+       */
+      assert(!"Invalid program binary cache item!");
+
+      if (ctx->_Shader->Flags & GLSL_CACHE_INFO) {
+         fprintf(stderr, "Error reading program from program binary\n");
+      }
+      sh_prog->data->LinkStatus = linking_failure;
+
+      return;
+   }
+
    sh_prog->data->LinkStatus = linking_success;
 }
-- 
2.14.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to