summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe/sp_buffer.c
diff options
context:
space:
mode:
authorThomas Hindoe Paaboel Andersen <[email protected]>2016-04-13 03:06:06 +0200
committerDave Airlie <[email protected]>2016-04-13 11:51:35 +1000
commit6d6525a377250865cc6baa2c9cd5c6c0b6cd3f9c (patch)
tree2385ea2f8daf3ce2a4b8d922f57cd8685f1fe61e /src/gallium/drivers/softpipe/sp_buffer.c
parentb89708f95fafc458cc79bc210407b723a0f0f78c (diff)
softpipe: avoid buffer overflow
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_buffer.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_buffer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/drivers/softpipe/sp_buffer.c b/src/gallium/drivers/softpipe/sp_buffer.c
index 69717baa1a0..69a6bd18c3b 100644
--- a/src/gallium/drivers/softpipe/sp_buffer.c
+++ b/src/gallium/drivers/softpipe/sp_buffer.c
@@ -59,7 +59,7 @@ sp_tgsi_load(const struct tgsi_buffer *buffer,
unsigned char *data_ptr;
const struct util_format_description *format_desc = util_format_description(PIPE_FORMAT_R32_UINT);
- if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+ if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
goto fail_write_all_zero;
bview = &sp_buf->sp_bview[params->unit];
@@ -117,7 +117,7 @@ sp_tgsi_store(const struct tgsi_buffer *buffer,
int j, c;
const struct util_format_description *format_desc = util_format_description(PIPE_FORMAT_R32_UINT);
- if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+ if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
return;
bview = &sp_buf->sp_bview[params->unit];
@@ -293,7 +293,7 @@ sp_tgsi_op(const struct tgsi_buffer *buffer,
int j, c;
unsigned char *data_ptr;
- if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+ if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
return;
bview = &sp_buf->sp_bview[params->unit];
@@ -345,7 +345,7 @@ sp_tgsi_get_dims(const struct tgsi_buffer *buffer,
struct pipe_shader_buffer *bview;
struct softpipe_resource *spr;
- if (params->unit > PIPE_MAX_SHADER_BUFFERS)
+ if (params->unit >= PIPE_MAX_SHADER_BUFFERS)
return;
bview = &sp_buf->sp_bview[params->unit];