Closed Bug 351007 Opened 19 years ago Closed 18 years ago

Crash [@ XPCWrappedNative::CallMethod] passing undefined to idl parameter of type out nsAString

Categories

(Core :: XPConnect, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: neil, Assigned: neil)

Details

(Keywords: crash, testcase)

Crash Data

Attachments

(1 file)

Note: this example is taken from mozilla.dev.extensions so it targets 1.0.x var f_h = Components.classes["@mozilla.org/satchel/form-history;1"].getService(Components.interfaces.nsIFormHistory); var f_name; var f_value; f_h.getEntryAt (0, f_name, f_value); nsIFormHistory.idl declares void getEntryAt(in unsigned long index, out AString name, out AString value); I reproduced the crash with SeaMonkey trunk using the wallet service which includes WALLET_PreEdit(out AString walletList); It crashes in XPCWrappedNative::CallMethod at the following line of code: if(!OBJ_SET_PROPERTY(ccx, JSVAL_TO_OBJECT(argv[i]), rt->GetStringID(XPCJSRuntime::IDX_VALUE), &v)) presumably because argv[i] is zero. Apparently an out AString actually compiles to an in dipper AString which isn't null-checked like other out params are.
Attached patch Possible patchSplinter Review
This fixes it for me, instead of crashing I now get an 0x80570002 nsresult.
(the comment 0 testcase passes undefined, not null)
Summary: Crash passing null to idl parameter of type out nsAString → Crash passing undefined to idl parameter of type out nsAString
(In reply to comment #2) >(the comment 0 testcase passes undefined, not null) It's not as if it makes any difference - the result is the same with 0, undefined, null etc...
oh... last time I ran into this, only undefined was a problem IIRC.
Comment on attachment 236378 [details] [diff] [review] Possible patch seems reasonable to me
Attachment #236378 - Flags: review?(dbradley)
Assignee: dbradley → nobody
Flags: blocking1.9?
Keywords: crash, testcase
Summary: Crash passing undefined to idl parameter of type out nsAString → Crash [@ XPCWrappedNative::CallMethod] passing undefined to idl parameter of type out nsAString
Marking blocker, I'll sr...
Assignee: nobody → neil
Flags: blocking1.9? → blocking1.9+
Attachment #236378 - Flags: review?(dbradley) → superreview?(jst)
Comment on attachment 236378 [details] [diff] [review] Possible patch r+sr=jst, let's get this one in.
Attachment #236378 - Flags: superreview?(jst)
Attachment #236378 - Flags: superreview+
Attachment #236378 - Flags: review+
Fix checked in.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Crash Signature: [@ XPCWrappedNative::CallMethod]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: