Mesa (master): glsl/blob: Return false from ensure_can_read on overrun

Jason Ekstrand jekstrand at kemper.freedesktop.org
Fri Oct 13 04:47:33 UTC 2017


Module: Mesa
Branch: master
Commit: 7118851374074bd92887bfabd47ce39c9be412fd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7118851374074bd92887bfabd47ce39c9be412fd

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Oct 11 10:56:48 2017 -0700

glsl/blob: Return false from ensure_can_read on overrun

Otherwise, if you have a large read fail and then try to do a small
read, the small read may succeed even though it's at the wrong offset.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Cc: mesa-stable at lists.freedesktop.org

---

 src/compiler/glsl/blob.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/glsl/blob.c b/src/compiler/glsl/blob.c
index 3c4aed8524..e837cdf2a0 100644
--- a/src/compiler/glsl/blob.c
+++ b/src/compiler/glsl/blob.c
@@ -207,6 +207,9 @@ blob_reader_init(struct blob_reader *blob, uint8_t *data, size_t size)
 static bool
 ensure_can_read(struct blob_reader *blob, size_t size)
 {
+   if (blob->overrun)
+      return false;
+
    if (blob->current < blob->end && blob->end - blob->current >= size)
       return true;
 




More information about the mesa-commit mailing list