ServiceImpl::UnregisterResource does not catch null uri

CLOSED FIXED in M9

Status

()

Core
RDF
P3
normal
CLOSED FIXED
19 years ago
18 years ago

People

(Reporter: John Bandhauer, Assigned: Chris Waterson)

Tracking

Trunk
x86
Windows NT
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: fix in hand)

(Reporter)

Description

19 years ago
ServiceImpl::UnregisterResource has

#ifdef REUSE_RESOURCE_URI_AS_KEY
    const char* uri;
    rv = aResource->GetValueConst(&uri);
#else
    nsXPIDLCString uri;
    rv = aResource->GetValue(getter_Copies(uri));
#endif
    if (NS_FAILED(rv)) return rv;
    PLHashEntry** hep = PL_HashTableRawLookup(mResources,
                           (*mResources->keyHash)(uri), uri);


(where REUSE_RESOURCE_URI_AS_KEY *is* #defined)

If the resource's uri == NULL, then GetValueConst returns NS_OK but we end up
passing a uri of NULL to PL_HashTableRawLookup and bad things happen.

It looks like you need a special check for uri == nsnull and a return of
whatever NS_ERROR_* makes sense to the caller.

I'm seeing this in the context of the call to
rdfService->UnregisterResource(this); in nsRDFResource::~nsRDFResource

This is when running in xpcshell :

var name = "component://netscape/rdf/resource-factory";

try {
    var foo = Components.classes[name].createInstance();
    print(foo);
    foo = null;
    gc();
} catch(e) {
    print("caught+e");
}
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
Target Milestone: M9
(Assignee)

Updated

19 years ago
Whiteboard: fix in hand
(Assignee)

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED

Comment 1

19 years ago
QA Contact massive update.

Comment 2

18 years ago
development issues - closing
Status: RESOLVED → CLOSED
You need to log in before you can comment on or make changes to this bug.