1
Description: fix denial of service and possible code execution via
3
Origin: backport, http://cgit.freedesktop.org/mesa/mesa/commit/?id=0677ea063cd96adefe87c1fb01ef7c66d905535b
4
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=59429
6
Index: mesa-9.1.3/src/mesa/drivers/dri/i965/brw_fs.cpp
7
===================================================================
8
--- mesa-9.1.3.orig/src/mesa/drivers/dri/i965/brw_fs.cpp 2013-06-18 13:53:12.200524978 -0400
9
+++ mesa-9.1.3/src/mesa/drivers/dri/i965/brw_fs.cpp 2013-06-18 13:53:12.196524978 -0400
11
import_uniforms_callback,
13
this->params_remap = v->params_remap;
14
+ this->nr_params_remap = v->nr_params_remap;
17
/* Our support for uniforms is piggy-backed on the struct
20
if (dispatch_width == 8) {
21
this->params_remap = ralloc_array(mem_ctx, int, c->prog_data.nr_params);
22
+ this->nr_params_remap = c->prog_data.nr_params;
24
for (unsigned int i = 0; i < c->prog_data.nr_params; i++)
25
this->params_remap[i] = -1;
26
@@ -1472,7 +1474,14 @@
27
if (inst->src[i].file != UNIFORM)
30
- assert(constant_nr < (int)c->prog_data.nr_params);
31
+ /* Section 5.11 of the OpenGL 4.3 spec says:
33
+ * "Out-of-bounds reads return undefined values, which include
34
+ * values from other variables of the active program or zero."
36
+ if (constant_nr < 0 || constant_nr >= (int)c->prog_data.nr_params) {
40
/* For now, set this to non-negative. We'll give it the
41
* actual new number in a moment, in order to keep the
42
@@ -1520,6 +1529,10 @@
43
if (inst->src[i].file != UNIFORM)
46
+ /* as above alias to 0 */
47
+ if (constant_nr < 0 || constant_nr >= (int)this->nr_params_remap) {
50
assert(this->params_remap[constant_nr] != -1);
51
inst->src[i].reg = this->params_remap[constant_nr];
52
inst->src[i].reg_offset = 0;
53
Index: mesa-9.1.3/src/mesa/drivers/dri/i965/brw_fs.h
54
===================================================================
55
--- mesa-9.1.3.orig/src/mesa/drivers/dri/i965/brw_fs.h 2013-06-18 13:53:12.200524978 -0400
56
+++ mesa-9.1.3/src/mesa/drivers/dri/i965/brw_fs.h 2013-06-18 13:53:12.196524978 -0400
61
+ int nr_params_remap;
63
struct hash_table *variable_ht;
65
Index: mesa-9.1.3/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
66
===================================================================
67
--- mesa-9.1.3.orig/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 2013-06-18 13:53:12.200524978 -0400
68
+++ mesa-9.1.3/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp 2013-06-18 13:53:12.196524978 -0400
70
this->virtual_grf_use = NULL;
71
this->live_intervals_valid = false;
73
+ this->params_remap = NULL;
74
+ this->nr_params_remap = 0;
76
this->force_uncompressed_stack = 0;
77
this->force_sechalf_stack = 0;