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

waves: verify payload size and initialize memory to zero to the allocated memory in waves.c #9009

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

barry-waves
Copy link
Contributor

Enhance payload corruption handling by verifying size

src/audio/module_adapter/module/waves/waves.c Outdated Show resolved Hide resolved
src/audio/module_adapter/module/waves/waves.c Outdated Show resolved Hide resolved
src/audio/module_adapter/module/waves/waves.c Outdated Show resolved Hide resolved
src/audio/module_adapter/module/waves/waves.c Outdated Show resolved Hide resolved
index += param->size;
}

return ret;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return 0

src/audio/module_adapter/module/waves/waves.c Outdated Show resolved Hide resolved
@johnylin76
Copy link
Contributor

Hi @lyakh,
at the same time I would like to ask about the retcode of get_data in module_adapter: https://github.com/thesofproject/sof/blob/main/src/audio/module_adapter/module_adapter_ipc4.c#L162

I wonder if module_adapter should return non-zero error code when interface->get_configuration does not support?
In the present design it returns 0 while not supported, leading to the consequence that the host side will consider get_data successful, but the data obtained is unpredictable.

@lyakh
Copy link
Collaborator

lyakh commented Apr 11, 2024

Hi @lyakh, at the same time I would like to ask about the retcode of get_data in module_adapter: https://github.com/thesofproject/sof/blob/main/src/audio/module_adapter/module_adapter_ipc4.c#L162

I wonder if module_adapter should return non-zero error code when interface->get_configuration does not support? In the present design it returns 0 while not supported, leading to the consequence that the host side will consider get_data successful, but the data obtained is unpredictable.

@johnylin76 that's a good point! All the more that calling ops.get_large_config() in handler.c anyway returns the same error whether the method is absent or it failed

ret = IPC4_MOD_INVALID_ID;
Could you submit a fix?

       allocated memory in waves.c

    Enhance payload corruption handling by verifying size
    and make sure to have clean buffer before using it.

Signed-off-by: barry.jan <barry.jan@waves.com>
@barry-waves barry-waves changed the title waves: verify payload size in waves.c waves: verify payload size and initialize memory to zero to the allocated memory in waves.c Apr 11, 2024
Copy link
Contributor

@johnylin76 johnylin76 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@johnylin76
Copy link
Contributor

Hi @lyakh, at the same time I would like to ask about the retcode of get_data in module_adapter: https://github.com/thesofproject/sof/blob/main/src/audio/module_adapter/module_adapter_ipc4.c#L162
I wonder if module_adapter should return non-zero error code when interface->get_configuration does not support? In the present design it returns 0 while not supported, leading to the consequence that the host side will consider get_data successful, but the data obtained is unpredictable.

@johnylin76 that's a good point! All the more that calling ops.get_large_config() in handler.c anyway returns the same error whether the method is absent or it failed

ret = IPC4_MOD_INVALID_ID;

Could you submit a fix?

Thanks. I will provide that in the other PR afterwards.

@lgirdwood lgirdwood merged commit 355e46f into thesofproject:main Apr 12, 2024
42 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants