meyers8686 / plist

Automatically exported from code.google.com/p/plist
0 stars 0 forks source link

UTF-16-BE Strings are not properly parsed #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The length of a UTF-16-BE string appears to be expressed in the number of 
double bytes and not single bytes. The current code incorrectly parses the 
attached file -- the string is truncated to half its correct length.

I fixed the problem by multiplying the length by two, in the 0x6 case:

                    if (intLength < 3) {
                        length = (int) parseUnsignedInt(copyOfRange(bytes, offset + 2, offset + 2 + intLength)) * 2;
                    } else {
                        length = new BigInteger(copyOfRange(bytes, offset + 2, offset + 2 + intLength)).intValue() * 2;
                    }

Original issue reported on code.google.com by robert.c...@gmail.com on 28 May 2011 at 2:42

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for pointing that out.
Fixed in r16.

Original comment by daniel.dreibrodt on 1 Jul 2011 at 7:37

GoogleCodeExporter commented 9 years ago

Original comment by daniel.dreibrodt on 25 Sep 2014 at 5:52