Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Allocate enough space for Unicode strings in binary property lists.#148

Merged
grp merged 1 commit into
masterfrom
grp/binary-asan
Oct 8, 2016
Merged

Allocate enough space for Unicode strings in binary property lists.#148
grp merged 1 commit into
masterfrom
grp/binary-asan

Conversation

@grp

@grp grp commented Oct 8, 2016

Copy link
Copy Markdown
Contributor

Before, only half as much space as needed was allocated. Fixes #145.

@grp grp assigned sas and Ktwu Oct 8, 2016
@grp

grp commented Oct 8, 2016

Copy link
Copy Markdown
Contributor Author

This seems right and it makes parsing get (much) further, but I don't know this code that well.

@Ktwu Ktwu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: both here and for UTF16, use something like 'size_t stringsize = sizeof(foo) * nchar'

@grp

grp commented Oct 8, 2016

Copy link
Copy Markdown
Contributor Author

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.
@grp grp force-pushed the grp/binary-asan branch from 57ac06a to b1e3a0d Compare October 8, 2016 17:31
@grp

grp commented Oct 8, 2016

Copy link
Copy Markdown
Contributor Author

Test added. Turns out it didn't decode the right string before either so the test did fail before the fix.

@Ktwu

Ktwu commented Oct 8, 2016

Copy link
Copy Markdown
Contributor

Lgtm

@Ktwu Ktwu closed this Oct 8, 2016
@Ktwu

Ktwu commented Oct 8, 2016

Copy link
Copy Markdown
Contributor

Sorry, finger slipped in mobile ui. Merge at your leisure.

@Ktwu Ktwu reopened this Oct 8, 2016
@grp grp merged commit f4d5004 into master Oct 8, 2016
@grp grp deleted the grp/binary-asan branch October 8, 2016 18:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants