New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NTOBJSHEX] Return early from GetInfoFromPidl when pcidl is null in LPCITEMIDLIST #4946
Conversation
LPCITEMIDLIST, this fixes crash when attempting to drag n drop items from NTObject Namespace and System Registry.
lgtm as based on my patch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very unreadable way of checking pcidl
for null, please do that instead.
? If he was to check something else than entry, then it would also make sense to move up the check. But honestly I do not really understand your request yet, Mark. |
No, checking pcidl->mkid is also wrong if
Think again.
indeed.
I am unsure what is unclear about 'xxx' is an unreadable way of doing 'yyy', please do 'yyy' instead. If the pointer math is confusing to you, try it out with a |
The GetInfoFromPidl(pidl, &info) gets called only if pidl in not null. Please see: https://github.com/reactos/reactos/blob/master/dll/shellext/ntobjshex/regfolder.cpp#L191 So pcidl in GetInfoFromPidl can not be null. |
You have checked just one invocation:
Clearly it is being called with null, otherwise your check would not catch it either. |
Ok how about checking if pcidl is not null before checking pcidl->mkid in GetInfoFromPidl? Like:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK; if pcidl is NULL then wouldn't this mean the GetInfoFromPidl function is called "incorrectly"? (if it's not expected to have either of its parameters being NULL)
@@ -484,6 +484,12 @@ HRESULT CNtObjectFolder::GetInfoFromPidl(LPCITEMIDLIST pcidl, const NtPidlEntry | |||
{ | |||
NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dll/shellext/ntobjshex/regfolder.cpp
Outdated
@@ -428,6 +428,12 @@ HRESULT CRegistryFolder::GetInfoFromPidl(LPCITEMIDLIST pcidl, const RegPidlEntry | |||
{ | |||
RegPidlEntry * entry = (RegPidlEntry*) &(pcidl->mkid); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid); | ||
if (!entry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is completely useless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that this check is not needed now that the preceeding check has been added (compiled and tested, crash is correctly protected). @muthu90tech : I suggest/support to remove this second useless check as suggested by Mark.
dll/shellext/ntobjshex/regfolder.cpp
Outdated
RegPidlEntry * entry = (RegPidlEntry*) &(pcidl->mkid); | ||
if (!entry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this check is completely useless
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that this check is not needed now that the preceeding check has been added (compiled and tested, crash is correctly protected). @muthu90tech : I suggest/support to remove this second useless check as suggested by Mark.
|
||
NtPidlEntry * entry = (NtPidlEntry*) &(pcidl->mkid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a convoluted way of writing NtPidlEntry * entry = (NtPidlEntry*)pcidl;
,
but whatever.
3 approved. Ready for merge ? |
Purpose
This fixes crash when attempting to drag n drop items from NTObject Namespace and System Registry.
Do a quick recap of your work here.
JIRA issues: CORE-18480, CORE-18481
Proposed changes
Perform a null check in GetInfoFromPidel on mkid in LPCITEMIDLIST
avoid_drag_drop_crash.mp4
(refer video, no more crash)