mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
st/glsl_to_tgsi: fix potential crash when allocating temporaries
When index - t->temps_size is greater than 4096, allocating space for
temporaries on demand will miserably crash. This can happen when a game
uses a lot of temporaries like the recent released Tomb raider.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: "11.1 11.2" <mesa-stable@lists.freedesktop.org>
(cherry picked from commit 8f2238ccba)
This commit is contained in:
parent
7cd7d19422
commit
970941fa86
1 changed files with 1 additions and 1 deletions
|
|
@ -4526,7 +4526,7 @@ dst_register(struct st_translate *t, gl_register_file file, unsigned index,
|
|||
case PROGRAM_TEMPORARY:
|
||||
/* Allocate space for temporaries on demand. */
|
||||
if (index >= t->temps_size) {
|
||||
const int inc = 4096;
|
||||
const int inc = align(index - t->temps_size + 1, 4096);
|
||||
|
||||
t->temps = (struct ureg_dst*)
|
||||
realloc(t->temps,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue