Conversation
1413b65 to
eb06c05
Compare
kr-t
approved these changes
Nov 17, 2025
If there is already a file in the filesystem with the same name and it is larger than the new size we are writing, the file size will not be truncated and we will end up with junk after the end of the wasm buffer. Use FS_O_TRUNC, so that the file will always be truncated to the new size. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
eb06c05 to
675fa82
Compare
PatrickRobbIOL
pushed a commit
to mgeeIOL/ocre-runtime
that referenced
this pull request
Dec 1, 2025
If there is already a file in the filesystem with the same name and it is larger than the new size we are writing, the file size will not be truncated and we will end up with junk after the end of the wasm buffer. Use FS_O_TRUNC, so that the file will always be truncated to the new size. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
casaroli
added a commit
that referenced
this pull request
Dec 7, 2025
If there is already a file in the filesystem with the same name and it is larger than the new size we are writing, the file size will not be truncated and we will end up with junk after the end of the wasm buffer. Use FS_O_TRUNC, so that the file will always be truncated to the new size. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
casaroli
added a commit
that referenced
this pull request
Jan 7, 2026
This reverts commit 734ed5c. This commit is kept in the legacy branch.
casaroli
added a commit
that referenced
this pull request
Jan 7, 2026
This reverts commit 734ed5c. This commit is kept in the legacy branch. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
casaroli
added a commit
that referenced
this pull request
Jan 7, 2026
This reverts commit 734ed5c. This commit is kept in the legacy branch. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
If there is already a file in the filesystem with the same name and it is larger than the new size we are writing, the file size will not be truncated and we will end up with junk after the end of the wasm buffer.
Use
FS_O_TRUNC, so that the file will always be truncated to the new size.Type of change
How Has This Been Tested?
OCRE_INPUT_FILEin CMakeLists.txt to a large wasm file.OCRE_INPUT_FILEin CMakeLists.txt to a shorter wasm file.fs rm /lfs/ocre/images/hello-world.binAfter applying this fix, step 4 should be OK also.
Test Configuration (required):
Zephyr 4.3Pimoroni Pico Plus 2WBut the same problem will happen on any platform.
Checklist: