Mesa (master): mesa: overallocate program parameter values
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 18 05:12:35 UTC 2020
Module: Mesa
Branch: master
Commit: 593dac802886dc8e3d8ac23ec5168883691e258c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=593dac802886dc8e3d8ac23ec5168883691e258c
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sun Nov 22 17:12:58 2020 -0500
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 at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8046>
---
src/mesa/program/prog_parameter.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c
index 1b46c2dee48..910bb269913 100644
--- a/src/mesa/program/prog_parameter.c
+++ b/src/mesa/program/prog_parameter.c
@@ -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);
}
}
More information about the mesa-commit
mailing list