Title: [98147] branches/safari-534.52-branch/Source/WebKit2
Diff
Modified: branches/safari-534.52-branch/Source/WebKit2/ChangeLog (98146 => 98147)
--- branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-21 21:07:12 UTC (rev 98146)
+++ branches/safari-534.52-branch/Source/WebKit2/ChangeLog 2011-10-21 21:08:05 UTC (rev 98147)
@@ -1,5 +1,32 @@
2011-10-21 Lucas Forschler <[email protected]>
+ Merge 97681
+
+ 2011-10-17 Jon Lee <[email protected]>
+
+ Filtering of URLs when serializing back forward list saves bad current index value
+ https://bugs.webkit.org/show_bug.cgi?id=70282
+ <rdar://problem/10057763>
+
+ Reviewed by Sam Weinig.
+
+ When reading the serialized b-f list, perform a sanity check on the current index.
+ If it is invalid, we set it to NoCurrentItemIndex to prevent further corruption of
+ the list.
+
+ When serializing the b-f list, currentIndex can be negative in the case where the list
+ has one item only, and that item gets filtered out. In this instance currentIndex should
+ just be -1. A crashing case showed an index that was more negative, a situation that I
+ could not replicate. Since this value will get cleaned up when the b-f list is restored,
+ I just strengthened the assertion to check for a more negative index in case we run into it again.
+
+ * UIProcess/cf/WebBackForwardListCF.cpp:
+ (WebKit::WebBackForwardList::createCFDictionaryRepresentation): Update the assertion
+ in case we go beyond NoCurrentItemIndex (which, as an int, is -1).
+ (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation):
+
+2011-10-21 Lucas Forschler <[email protected]>
+
Merge 96864
2011-10-06 Anders Carlsson <[email protected]>
Modified: branches/safari-534.52-branch/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp (98146 => 98147)
--- branches/safari-534.52-branch/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp 2011-10-21 21:07:12 UTC (rev 98146)
+++ branches/safari-534.52-branch/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp 2011-10-21 21:08:05 UTC (rev 98147)
@@ -79,7 +79,7 @@
CFArrayAppendValue(entries.get(), entryDictionary.get());
}
- ASSERT(currentIndex < CFArrayGetCount(entries.get()));
+ ASSERT(currentIndex < CFArrayGetCount(entries.get()) && currentIndex >= static_cast<int>(NoCurrentItemIndex));
RetainPtr<CFNumberRef> currentIndexNumber(AdoptCF, CFNumberCreate(0, kCFNumberIntType, ¤tIndex));
const void* keys[2] = { SessionHistoryCurrentIndexKey(), SessionHistoryEntriesKey() };
@@ -155,8 +155,11 @@
newEntries.append(WebBackForwardListItem::create(originalURL, entryURL, entryTitle, CFDataGetBytePtr(backForwardData), CFDataGetLength(backForwardData), generateWebBackForwardItemID()));
}
+ m_entries = newEntries;
m_current = currentIndex;
- m_entries = newEntries;
+ // Perform a sanity check: in case we're out of range, we reset.
+ if (m_current != NoCurrentItemIndex && m_current >= newEntries.size())
+ m_current = NoCurrentItemIndex;
return true;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes