Skip to content

file_simple: Allocate correct buffer size for writing sections out - #165

Merged
dbaluta merged 1 commit into
thesofproject:mainfrom
paulstelian97:fix_calloc_valgrind
May 30, 2023
Merged

dbaluta merged 1 commit into
thesofproject:mainfrom
paulstelian97:fix_calloc_valgrind

Conversation

@paulstelian97

Copy link
Copy Markdown

The original size given to the "calloc" call did not account for the necessity to pad section sizes to a multiple of 4 bytes. As such, every time we wrote a section that did not have a size multiple of 4 we would overflow the allocated buffer.

Fix the calloc call to account for that padding requirement.

The original size given to the "calloc" call did not account for the
necessity to pad section sizes to a multiple of 4 bytes. As such, every
time we wrote a section that did not have a size multiple of 4 we would
overflow the allocated buffer.

Fix the calloc call to account for that padding requirement.

Signed-off-by: Paul Olaru <[email protected]>
@marc-hb

marc-hb commented May 30, 2023

Copy link
Copy Markdown
Contributor

Just for the record this was found by valgrind in zephyrproject-rtos/zephyr#58356

@dbaluta
dbaluta merged commit 649b0a6 into thesofproject:main May 30, 2023
@paulstelian97
paulstelian97 deleted the fix_calloc_valgrind branch May 30, 2023 19:33
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