Allocate enough space for Unicode strings in binary property lists.#148
Conversation
|
This seems right and it makes parsing get (much) further, but I don't know this code that well. |
Ktwu
left a comment
There was a problem hiding this comment.
I'm ok getting this in to unblock William, but we really need to start writing unit tests.
@grp, can you follow this up with a test? Merging a test binary plist with some emojis in it and making we can parse out expected values seems good enough for now.
| return nullptr; | ||
|
|
||
| string.resize(nchars); | ||
| string.resize(sizeof(char) * nchars); |
There was a problem hiding this comment.
Nit: both here and for UTF16, use something like 'size_t stringsize = sizeof(foo) * nchar'
|
I'll add a test, although I'm not sure how to check anything except that it doesn't violate ASAN. With #131 that should be enough though. |
Before, only half as much space as needed was allocated.
|
Test added. Turns out it didn't decode the right string before either so the test did fail before the fix. |
|
Lgtm |
|
Sorry, finger slipped in mobile ui. Merge at your leisure. |
Before, only half as much space as needed was allocated. Fixes #145.