mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
security: fix OOB read in IEC958 format enum parsing
In the SPA_CHOICE_Enum case, values[index+1] was used to skip the default value at index 0, but the bounds check only validated index, not index+1. Move bounds checks into each case with the correct limit. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
390874e7c3
commit
e1f4c441f4
1 changed files with 4 additions and 3 deletions
|
|
@ -750,16 +750,17 @@ static int format_info_iec958_from_param(struct format_info *info, struct spa_po
|
|||
if (val->type != SPA_TYPE_Id)
|
||||
return -ENOTSUP;
|
||||
|
||||
if (index >= n_values)
|
||||
return -ENOENT;
|
||||
|
||||
values = SPA_POD_BODY(val);
|
||||
|
||||
switch (choice) {
|
||||
case SPA_CHOICE_None:
|
||||
if (index >= n_values)
|
||||
return -ENOENT;
|
||||
info->encoding = format_encoding_from_id(values[index]);
|
||||
break;
|
||||
case SPA_CHOICE_Enum:
|
||||
if (index + 1 >= n_values)
|
||||
return -ENOENT;
|
||||
info->encoding = format_encoding_from_id(values[index+1]);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue