This issue is very similar to #13 and there is a lot of relevant discussion there.
Observed
- If
strz is used with UTF-16 or UTF-32 then a single null byte is enough to result in termination rather than 2 (U16) or 4 (U32) bytes.
Expected
- If the encoding is given as UTF-16 or UTF-32 then the
strz parse only terminates when the corresponding number of consecutive null bytes appear.
To describe the use case, I am writing a descriptor for the output of an internal Windows tool which reserves a fixed length for the string then null terminates it. While this practice is a bit inefficient and I can't point to any widely used formats that do the same I suspect that it is not uncommon for Windows programs since it is analogous to doing so with UTF-8 in a cross-platform or Unix scenario.
On Windows, an example C struct might look like this:
struct TextBlob
{
UCHAR DataPrefix[n];
WCHAR WideString[64];
UCHAR DataSuffix[n];
};
For an example data blob and ksy file that that minimally reproduce the issue (at least with the web IDE) please see the following zip:
utf16_test.zip
This issue is very similar to #13 and there is a lot of relevant discussion there.
Observed
strzis used with UTF-16 or UTF-32 then a single null byte is enough to result in termination rather than 2 (U16) or 4 (U32) bytes.Expected
strzparse only terminates when the corresponding number of consecutive null bytes appear.To describe the use case, I am writing a descriptor for the output of an internal Windows tool which reserves a fixed length for the string then null terminates it. While this practice is a bit inefficient and I can't point to any widely used formats that do the same I suspect that it is not uncommon for Windows programs since it is analogous to doing so with UTF-8 in a cross-platform or Unix scenario.
On Windows, an example C struct might look like this:
For an example data blob and ksy file that that minimally reproduce the issue (at least with the web IDE) please see the following zip:
utf16_test.zip