mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-30 06:46:49 -04:00
security: add missing NULL check after calloc in plugin_builtin
Memory Safety: Medium In the fallback code path when spa-plugins support is not compiled in, calloc() for the output sample buffer was not checked for NULL. If the allocation fails (e.g., due to a large n_samples value from filter configuration), spa_memcpy would dereference a NULL pointer. Fixed by adding a NULL check and returning NULL on allocation failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1de8615caf
commit
08efbf2254
1 changed files with 2 additions and 0 deletions
|
|
@ -1014,6 +1014,8 @@ error:
|
||||||
#else
|
#else
|
||||||
spa_log_error(impl->log, "compiled without spa-plugins support, can't resample");
|
spa_log_error(impl->log, "compiled without spa-plugins support, can't resample");
|
||||||
float *out_samples = calloc(*n_samples, sizeof(float));
|
float *out_samples = calloc(*n_samples, sizeof(float));
|
||||||
|
if (out_samples == NULL)
|
||||||
|
return NULL;
|
||||||
spa_memcpy(out_samples, samples, *n_samples * sizeof(float));
|
spa_memcpy(out_samples, samples, *n_samples * sizeof(float));
|
||||||
return out_samples;
|
return out_samples;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue