Skip to content

Add a null-pointer check before processing base::SupportsUserData::GetUserData - #10676

Merged
zcbenz merged 1 commit into
electron:masterfrom
qazbnm456:fix-unhandle-null-pointer
Oct 3, 2017
Merged

zcbenz merged 1 commit into
electron:masterfrom
qazbnm456:fix-unhandle-null-pointer

Conversation

@qazbnm456

Copy link
Copy Markdown
Contributor

As #10429 got merged in Electron v1.8.x, I've discovered that we didn't check if wrapped is a valid object or not here.
This will then cause the Electron to crash if the wrapped object doesn't belong to a valid memory we can touch.

In this PR, I've added a check before calling the SupportsUserData::GetUserData function and also modified the code of TrackableObjectBase::AttachAsUserData to call from SupportsUserData with std::unique_ptr rather than raw-pointer as suggested here.

Thanks!

@zcbenz
zcbenz merged commit 150a479 into electron:master Oct 3, 2017
@qazbnm456
qazbnm456 deleted the fix-unhandle-null-pointer branch October 3, 2017 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants