Created attachment 261093[details][diff][review]
null check before calling (trivial one line patch)
(see URL)
If somebody passing a nsIRDFNode that is not a nsIRDFResource to nsGlobalHistory::GetSource, QI fails and null is passed to IsURLInHistory leading to null pointer dereference.
This was actually found via poking the Firefox 2.0.0.x history (in #extdev), but I'm assuming nobody would want to review non-Places history backend there. So I checked the suite version manually - note though, I haven't actually attempted to reproduce this.
-- Code used to trigger: (from johnm on IRC)
var RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var HDS = RDF.GetDataSource("rdf:history");
var urlArc = RDF.GetResource("http://home.netscape.com/NC-rdf#URL");
/* note that urltomatch should have been a resource, not a literal */
var urltomatch = RDF.GetLiteral("http://www.google.com");
/* crashes on the next line */
var subject = HDS.GetSource(urlArc, urltomatch, true);
Will attach patch, but I haven't actually tried to reproduce on suite yet... :)
Hmm, should I check in the caller, or callee? All other callers do the check...