Skip to content

Fix unicode conversion truncation bug (1.2.3)#1231

Merged
val-ms merged 1 commit intoCisco-Talos:dev/1.2.3from
val-ms:CLAM-2607-entconv-bugs-truncation-1.2.3
Apr 12, 2024
Merged

Fix unicode conversion truncation bug (1.2.3)#1231
val-ms merged 1 commit intoCisco-Talos:dev/1.2.3from
val-ms:CLAM-2607-entconv-bugs-truncation-1.2.3

Conversation

@val-ms
Copy link
Contributor

@val-ms val-ms commented Apr 12, 2024

Backport of #1220


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.

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 merged commit 7178542 into Cisco-Talos:dev/1.2.3 Apr 12, 2024
@val-ms val-ms deleted the CLAM-2607-entconv-bugs-truncation-1.2.3 branch April 12, 2024 16:34
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.

1 participant