mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
mesa: do not pass NULL pointer to function not expecting NULLs
First argument for qsort() is declared to be never NULL, so ensure NULL is never passed. This has been detected by Undefined Behaviour Sanitizer (UBSan). Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29772>
This commit is contained in:
parent
91593adc93
commit
0d1813837b
1 changed files with 3 additions and 0 deletions
|
|
@ -414,6 +414,9 @@ _mesa_add_separate_state_parameters(struct gl_program *prog,
|
|||
{
|
||||
unsigned num_state_params = state_params->NumParameters;
|
||||
|
||||
if (num_state_params == 0)
|
||||
return;
|
||||
|
||||
/* All state parameters should be vec4s. */
|
||||
for (unsigned i = 0; i < num_state_params; i++) {
|
||||
assert(state_params->Parameters[i].Type == PROGRAM_STATE_VAR);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue