Skip to content
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

UBSAN fuzzing fixes #9433

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ipc/ipc3/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,6 @@ static int ipc_trace_filter_update(uint32_t header)
int cnt;

packet = ipc->comp_data;
elem = packet->elems;
end = &packet->elems[packet->elem_cnt];

/* validation, packet->hdr.size has already been compared with SOF_IPC_MSG_MAX_SIZE */
if (sizeof(*packet) + sizeof(*elem) * packet->elem_cnt != packet->hdr.size) {
Expand All @@ -917,6 +915,9 @@ static int ipc_trace_filter_update(uint32_t header)
tr_info(&ipc_tr, "ipc: trace_filter_update received, size %d elems",
packet->elem_cnt);

elem = packet->elems;
end = &packet->elems[packet->elem_cnt];

/* read each filter set and update selected components trace settings */
while (elem != end) {
next_elem = trace_filter_fill(elem, end, &filter);
Expand Down
3 changes: 2 additions & 1 deletion src/ipc/ipc3/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ static const struct comp_driver *get_drv(struct sof_ipc_comp *comp)
* which derived comp we have and how much its specific members
* add.
*/
if (comp->hdr.size < sizeof(*comp) + comp->ext_data_length) {
if (comp->ext_data_length > SOF_IPC_MSG_MAX_SIZE ||
comp->hdr.size < sizeof(*comp) + comp->ext_data_length) {
tr_err(&comp_tr, "Invalid size, hdr.size=0x%x, ext_data_length=0x%x\n",
comp->hdr.size, comp->ext_data_length);
goto out;
Expand Down