Closed
Bug 581473
Opened 14 years ago
Closed 13 years ago
possible uninitialized variable use in XPCConvert::JSData2Native
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: jdm, Assigned: atulagrwl)
References
(Blocks 1 open bug)
Details
(Whiteboard: [build_warning])
Attachments
(1 file, 1 obsolete file)
1.12 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
js/src/xpconnect/src/xpcconvert.cpp: In static member function ‘static JSBool XPCConvert::JSData2Native(XPCCallContext&, void*, jsval, const nsXPTType&, JSBool, const nsID*, nsresult*)':
js/src/xpconnect/src/xpcconvert.cpp:683: warning: ‘chars’ may be used uninitialized in this function
js/src/xpconnect/src/xpcconvert.cpp:686: warning: ‘length’ may be used uninitialized in this function
Comment 1•14 years ago
|
||
This is your typical "gcc's flow analysis is broken" warning. The code that looks like this:
if (JSVAL_IS_VOID(s)) {
...
} else if (!JSVAL_IS_NULL(s)) {
}
initializes length and chars in all cases except JSVAL_IS_NULL(s). Then below that the codepaths that use str and chars are guarded so that we don't take them when JSVAL_IS_NULL(s).
Is there any way to silence this warning for known-good code?
Reporter | ||
Updated•14 years ago
|
Whiteboard: [build_warning]
Updated•13 years ago
|
Blocks: buildwarning
Assignee | ||
Comment 2•13 years ago
|
||
Please note I could not test this patch.
Assignee: nobody → atulagrwl
Status: NEW → ASSIGNED
Assignee | ||
Updated•13 years ago
|
Attachment #557279 -
Flags: review?(mrbkap)
Comment 3•13 years ago
|
||
Comment on attachment 557279 [details] [diff] [review]
Patch v1 to fix warning
Since we should never use this value, I'd prefer to initialize chars to nsnull here so we'll crash if we accidentally do use it. I'll r+ a patch with that change.
Attachment #557279 -
Flags: review?(mrbkap)
Assignee | ||
Comment 4•13 years ago
|
||
Change suggested by reviewer.
Attachment #557279 -
Attachment is obsolete: true
Attachment #562313 -
Flags: review?(mrbkap)
Updated•13 years ago
|
Attachment #562313 -
Flags: review?(mrbkap) → review+
Assignee | ||
Updated•13 years ago
|
Keywords: checkin-needed
Comment 5•13 years ago
|
||
Keywords: checkin-needed
Whiteboard: [build_warning] → [build_warning][inbound]
Target Milestone: --- → mozilla9
Comment 6•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [build_warning][inbound] → [build_warning]
You need to log in
before you can comment on or make changes to this bug.
Description
•