Last Modified: Sep 13, 2023
Known Affected Versions:
12.1.2, 12.1.3, 22.214.171.124
Opened: Sep 15, 2017 Severity: 3-Major
ASN1::encode returns incorrect data for certain integer values. For example, for integer 49280, ASN1::encode returns 02030000.
The returned binary is wrong.
The problem happens in an implicit UTF encoding/decoding, and it is not obvious what data triggers the error. This is because it implicitly converts the Tcl object type from byte array to string and later back to byte array, but because of the UTF de-coding algorithm, certain bytes get changed.
Use binary scan for the value that is incorrectly encoded by the command.
ASN1::encode ENCODE mode now works so that it avoids the implicit type-conversion byte array to string back to byte array, which gets the original byte array changed during UTF-8 decoding.