main/texobj: Check that texture id > 0 before looking it up in hash-table
authorEduardo Lima Mitev <elima@igalia.com>
Wed, 23 Nov 2016 13:44:05 +0000 (14:44 +0100)
committerEduardo Lima Mitev <elima@igalia.com>
Thu, 24 Nov 2016 07:23:45 +0000 (08:23 +0100)
commit89cbe0d21f8ed47f992b04b4a5595c4801d2b397
treec275b9e3fcabf58319de2f7608bcc0f23899455e
parent3233a9fe0bae9e6dd52a0d5a5c19f338960e8487
main/texobj: Check that texture id > 0 before looking it up in hash-table

_mesa_lookup_texture_err() is not currently checking that the
texture-id can be zero, but _mesa_HashLookup() doesn't expect the key
to be zero, and will fail an assertion.

Considering that _mesa_lookup_texture_err() is called from
_mesa_GetTextureImage and _mesa_GetTextureSubImage with user provided
arguments, we must validate the texture-id before looking it up in the
hash-table.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/main/texobj.c