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 unicode conversion truncation bug #1220

Merged

Conversation

micahsnyder
Copy link
Contributor

The in_iconv_u16() function resolves "alignment" issues where the length of the input string is not mod(4). The solution trims the extra bytes off the input string. If the input string is total less than 4 bytes, then those extra bytes are put in a 4-byte array and are converted. However, if the input string is longer, then those extra bytes are lost.

This fix saves the extra "unaligned" bytes in the 4-byte array and converts them afterwards so we don't accidentally lose 1 to 2 characters.

@micahsnyder micahsnyder added the 🍒cherry-pick-candidate A PR that should be backported once approved. label Mar 29, 2024
The in_iconv_u16() function resolves "alignment" issues where the length
of the input string is not mod(4). The solution trims the extra bytes
off the input string. If the input string is total less than 4 bytes,
then those extra bytes are put in a 4-byte array and are converted.
However, if the input string is longer, then those extra bytes are lost.

This fix saves the extra "unaligned" bytes in the 4-byte array and
converts them afterwards so we don't accidentally lose 1 to 2
characters.
@micahsnyder micahsnyder force-pushed the CLAM-2607-entconv-bugs-truncation branch from 146196e to a54d13e Compare April 11, 2024 22:17
@micahsnyder
Copy link
Contributor Author

Just rebased with main. No changes.

@micahsnyder micahsnyder merged commit 7136344 into Cisco-Talos:main Apr 12, 2024
23 of 24 checks passed
@micahsnyder micahsnyder deleted the CLAM-2607-entconv-bugs-truncation branch April 12, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒cherry-pick-candidate A PR that should be backported once approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants