Skip to content

Fix RangeError on a unicode property with an odd byte length - #84

Merged
kenjiuno merged 1 commit into
HiraokaHyperTools:masterfrom
nfcampos:odd-length-unicode
Nov 10, 2026
Merged

kenjiuno merged 1 commit into
HiraokaHyperTools:masterfrom
nfcampos:odd-length-unicode

Conversation

@nfcampos

Copy link
Copy Markdown
Contributor

getFileData() throws RangeError: Invalid typed array length when a unicode property (001F) has an odd byte length. We hit it on a .msg whose __substg1.0_1000001F held 8-bit text.

array.length / 2 is fractional, so readUint16Array allocates the truncated length but copies one byte more. Flooring it drops the stray byte. Test included.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kenjiuno

Copy link
Copy Markdown
Contributor

Hi, thanks for the info and codes.
Although I'm not confident there are fraud msg files that you mention, I'll accept this pr.

@kenjiuno
kenjiuno merged commit 739ca3f into HiraokaHyperTools:master Nov 10, 2026
2 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.

2 participants