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

Fix FWFS builder handling of UTF8-encoded filenames #2945

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Feb 7, 2025

The FWFS filesystem builder (python) produces invalid structures if filename contains UTF8-encoded characters. The length was based on the unencoded text (unicode) so will be smaller than the actual filename.

For example, CharactersÄÖÜß.txt is 18 unicode characters, but Ä, Ö, Ü and ß each require two bytes when encoded as UTF8 so stores 22 characters. The FWFS structures store this as a counted string with length 18 so the extraneous 4 bytes are interpreted as part of the following data which results in an unreadable filesystem image. This PR fixes the length calculation using the encoded text.

Note that the IFS C++ code treats filenames as opaque binary strings so is not affected by this bug.

@SmingHub SmingHub deleted a comment from what-the-diff bot Feb 7, 2025
@slaff slaff added this to the 6.1.0 milestone Feb 7, 2025
@slaff slaff merged commit ddcd288 into SmingHub:develop Feb 10, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants