-
Notifications
You must be signed in to change notification settings - Fork 361
tplg: reject zero-size arrays and undersized private data #10938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,6 +151,11 @@ static int process_append_data3(void *_process_ipc, | |
|
|
||
| /* Size is process IPC plus private data minus ABI header */ | ||
| bytes_ctl = (struct snd_soc_tplg_bytes_control *)ctl; | ||
| if (bytes_ctl->priv.size < sizeof(struct sof_abi_hdr)) { | ||
| fprintf(stderr, "error: process priv data too small: %u\n", | ||
| bytes_ctl->priv.size); | ||
| return -EINVAL; | ||
| } | ||
|
Comment on lines
+154
to
+158
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| size = bytes_ctl->priv.size - sizeof(struct sof_abi_hdr); | ||
| ipc_size = sizeof(struct sof_ipc_comp_process) + UUID_SIZE + | ||
| process_ipc->size + size; | ||
|
|
@@ -184,6 +189,11 @@ static int process_append_data4(void *_process_ipc, | |
|
|
||
| /* Size is process IPC plus private data minus ABI header */ | ||
| bytes_ctl = (struct snd_soc_tplg_bytes_control *)ctl; | ||
| if (bytes_ctl->priv.size < sizeof(struct sof_abi_hdr)) { | ||
| fprintf(stderr, "error: process priv data too small: %u\n", | ||
| bytes_ctl->priv.size); | ||
| return -EINVAL; | ||
| } | ||
|
Comment on lines
+192
to
+196
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same — |
||
| size = bytes_ctl->priv.size - sizeof(struct sof_abi_hdr); | ||
|
|
||
| /* validate if everything will fit */ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%sisname(the object/widget type being loaded), matching the other error messages in this same function (e.g. "error: load %s array size mismatch"). Kept it consistent with the existing logging style here.