Fix null pointer dereference introduced by Changeset 121874.
authormacpherson@chromium.org <macpherson@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2012 07:09:21 +0000 (07:09 +0000)
committermacpherson@chromium.org <macpherson@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2012 07:09:21 +0000 (07:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=91578

Reviewed by Pavel Feldman.

In http://trac.webkit.org/changeset/121874/trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp I introduced code that
dereferences the return value of ownerDocument() without doing a null check. This was a bad idea.

No new tests. I don't have a repro case, but it is clear from reading the code for ownerDocument() that it can return null.

* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::ensureSourceData):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@122923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorStyleSheet.cpp

index c32d28d..b2e5229 100644 (file)
@@ -1,3 +1,18 @@
+2012-07-18  Luke Macpherson   <macpherson@chromium.org>
+
+        Fix null pointer dereference introduced by Changeset 121874.
+        https://bugs.webkit.org/show_bug.cgi?id=91578
+
+        Reviewed by Pavel Feldman.
+
+        In http://trac.webkit.org/changeset/121874/trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp I introduced code that
+        dereferences the return value of ownerDocument() without doing a null check. This was a bad idea.
+
+        No new tests. I don't have a repro case, but it is clear from reading the code for ownerDocument() that it can return null.
+
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::ensureSourceData):
+
 2012-07-17  Yoshifumi Inoue  <yosin@chromium.org>
 
         Decimal constructor with 99999999999999999 loses last digit
index 5f5bb05..b264399 100644 (file)
@@ -1116,7 +1116,8 @@ bool InspectorStyleSheet::ensureSourceData()
         return false;
 
     RefPtr<StyleSheetContents> newStyleSheet = StyleSheetContents::create();
-    CSSParser p(m_pageStyleSheet->ownerDocument());
+    Document* ownerDocument = m_pageStyleSheet->ownerDocument();
+    CSSParser p(ownerDocument ?  CSSParserContext(ownerDocument) : strictCSSParserContext());
     OwnPtr<RuleSourceDataList> ruleSourceDataResult = adoptPtr(new RuleSourceDataList());
     p.parseSheet(newStyleSheet.get(), m_parsedStyleSheet->text(), 0, ruleSourceDataResult.get());
     m_parsedStyleSheet->setSourceData(ruleSourceDataResult.release());