Closed Bug 11575 Opened 25 years ago Closed 25 years ago

ServiceImpl::UnregisterResource does not catch null uri

Categories

(Core Graveyard :: RDF, defect, P3)

x86
Windows NT
defect

Tracking

(Not tracked)

CLOSED FIXED

People

(Reporter: jband_mozilla, Assigned: waterson)

Details

(Whiteboard: fix in hand)

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");
}
Status: NEW → ASSIGNED
Target Milestone: M9
Whiteboard: fix in hand
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
QA Contact massive update.
development issues - closing
Status: RESOLVED → CLOSED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.