Skip to content

Fix unicode conversion truncation bug#1220

Merged
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:CLAM-2607-entconv-bugs-truncation
Apr 12, 2024
Merged

Fix unicode conversion truncation bug#1220
val-ms merged 1 commit intoCisco-Talos:mainfrom
val-ms:CLAM-2607-entconv-bugs-truncation

Conversation

@val-ms
Copy link
Contributor

@val-ms val-ms commented 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.

@val-ms val-ms 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.
@val-ms val-ms force-pushed the CLAM-2607-entconv-bugs-truncation branch from 146196e to a54d13e Compare April 11, 2024 22:17
@val-ms
Copy link
Contributor Author

val-ms commented Apr 11, 2024

Just rebased with main. No changes.

@val-ms val-ms merged commit 7136344 into Cisco-Talos:main Apr 12, 2024
@val-ms val-ms 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