mesa: overallocate program parameter values

See the comment. This is something I spotted in the code. There is
no known bug caused by this.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
This commit is contained in:
Marek Olšák 2020-11-22 17:12:58 -05:00 committed by Marge Bot
parent 884e84035e
commit 593dac8028

View file

@ -223,8 +223,12 @@ _mesa_reserve_parameter_storage(struct gl_program_parameter_list *paramList,
paramList->ParameterValues = (gl_constant_value *)
align_realloc(paramList->ParameterValues, /* old buf */
oldNum * 4 * sizeof(gl_constant_value),/* old sz */
paramList->SizeValues * 4 * sizeof(gl_constant_value),/*new*/
16);
/* Overallocate the size by 12 because matrix rows can
* be allocated partially but fetch_state always writes
* 4 components (16 bytes).
*/
paramList->SizeValues * 4 * sizeof(gl_constant_value) +
12, 16);
}
}