summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-10-11 10:56:48 -0700
committerJason Ekstrand <[email protected]>2017-10-12 21:47:06 -0700
commit7118851374074bd92887bfabd47ce39c9be412fd (patch)
treedb9d2f23a0d5c0179d2b6c5c5c8b804d463a5a0f /src/compiler
parentc866e0b3ca563de579d0231278239aa6427c9ddf (diff)
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 <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Cc: [email protected]
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/blob.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/glsl/blob.c b/src/compiler/glsl/blob.c
index 3c4aed8524d..e837cdf2a0b 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;