Closed Bug 581473 Opened 14 years ago Closed 13 years ago

possible uninitialized variable use in XPCConvert::JSData2Native

Categories

(Core :: XPConnect, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla9

People

(Reporter: jdm, Assigned: atulagrwl)

References

(Blocks 1 open bug)

Details

(Whiteboard: [build_warning])

Attachments

(1 file, 1 obsolete file)

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
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?
Whiteboard: [build_warning]
Blocks: buildwarning
Attached patch Patch v1 to fix warning (obsolete) — Splinter Review
Please note I could not test this patch.
Assignee: nobody → atulagrwl
Status: NEW → ASSIGNED
Attachment #557279 - Flags: review?(mrbkap)
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)
Attached patch Patch v2Splinter Review
Change suggested by reviewer.
Attachment #557279 - Attachment is obsolete: true
Attachment #562313 - Flags: review?(mrbkap)
Attachment #562313 - Flags: review?(mrbkap) → review+
Keywords: checkin-needed
Keywords: checkin-needed
Whiteboard: [build_warning] → [build_warning][inbound]
Target Milestone: --- → mozilla9
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.

Attachment

General

Creator:
Created:
Updated:
Size: