glsl: Fix crash due to negative array index
authorAnuj Phogat <anuj.phogat@gmail.com>
Thu, 18 Sep 2014 23:30:31 +0000 (16:30 -0700)
committerAnuj Phogat <anuj.phogat@gmail.com>
Wed, 22 Oct 2014 23:13:37 +0000 (16:13 -0700)
commit6f0089e92e9a3b096b978bb09a87db6a38acb7b2
tree32e9cae1c76ec629753b54d898f2544460324c02
parent8ec40adf7eaaf4a107ee76497d69d1479580f711
glsl: Fix crash due to negative array index

Currently Mesa crashes with a shader like this:

[fragmnet shader]
float[5] array;
int idx = -2;
void main()
{
   gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]);
}

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/glsl/opt_array_splitting.cpp