Closed Bug 1273128 Opened 9 years ago Closed 9 years ago

[Static Analysis][Dereference before null check] In function nsMenuBarListener::KeyPress

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1361780)

Attachments

(1 file)

The Static Analysis tool Coverity added that variable |nativeKeyEvent| is derefernced before being null checked. dereference: >> // If accesskey handling was forwarded to a child process, wait for >> // the mozaccesskeynotfound event before handling accesskeys. >> WidgetKeyboardEvent* nativeKeyEvent = >> aKeyEvent->WidgetEventPtr()->AsKeyboardEvent(); >> if (nativeKeyEvent->mAccessKeyForwardedToChild) { >> return NS_OK; >> } null-check: >> bool hasAccessKeyCandidates = charCode != 0; >> if (!hasAccessKeyCandidates) { >> if (nativeKeyEvent) { >> AutoTArray<uint32_t, 10> keys; >> nativeKeyEvent->GetAccessKeyCandidates(keys); >> hasAccessKeyCandidates = !keys.IsEmpty(); >> } >> }
Comment on attachment 8752817 [details] MozReview Request: Bug 1273128 - prevent null pointer dereference on |nativeKeyEvent|. r?janv https://reviewboard.mozilla.org/r/52804/#review51428 r=me
Attachment #8752817 - Flags: review?(jvarga) → review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
Component: XP Toolkit/Widgets: Menus → XUL
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: