Changeset 27196 in webkit
- Timestamp:
- Oct 28, 2007, 6:29:48 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r27193 r27196 1 2007-10-28 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Mark. 4 5 - Added assertions to protect against adding empty or deleted keys to a HashTable 6 7 * wtf/HashTable.h: 8 (WTF::HashTable::lookup): 9 (WTF::HashTable::lookupForWriting): 10 (WTF::HashTable::fullLookupForWriting): 11 (WTF::HashTable::add): 12 1 13 2007-10-28 Darin Adler <darin@apple.com> 2 14 -
trunk/JavaScriptCore/wtf/HashTable.h
r27176 r27196 403 403 { 404 404 ASSERT(m_table); 405 #ifndef ASSERT_DISABLED 406 if (HashFunctions::safeToCompareToEmptyOrDeleted) { 407 ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key)); 408 ASSERT(!HashTranslator::equal(KeyTraits::deletedValue(), key)); 409 } 410 #endif 405 411 406 412 int k = 0; … … 447 453 { 448 454 ASSERT(m_table); 455 #ifndef ASSERT_DISABLED 456 if (HashFunctions::safeToCompareToEmptyOrDeleted) { 457 ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key)); 458 ASSERT(!HashTranslator::equal(KeyTraits::deletedValue(), key)); 459 } 460 #endif 449 461 450 462 int k = 0; … … 498 510 { 499 511 ASSERT(m_table); 512 #ifndef ASSERT_DISABLED 513 if (HashFunctions::safeToCompareToEmptyOrDeleted) { 514 ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key)); 515 ASSERT(!HashTranslator::equal(KeyTraits::deletedValue(), key)); 516 } 517 #endif 500 518 501 519 int k = 0; … … 548 566 inline pair<typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator, bool> HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::add(const T& key, const Extra& extra) 549 567 { 568 #ifndef ASSERT_DISABLED 569 if (HashFunctions::safeToCompareToEmptyOrDeleted) { 570 ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key)); 571 ASSERT(!HashTranslator::equal(KeyTraits::deletedValue(), key)); 572 } 573 #endif 574 550 575 invalidateIterators(); 551 576 -
trunk/WebCore/ChangeLog
r27190 r27196 1 2007-10-28 Maciej Stachowiak <mjs@apple.com> 2 3 Reviewed by Mark. 4 5 - fixed REGRESSION(r27176): Reproducible crash while trying to order dinner makes bdash sad 6 http://bugs.webkit.org/show_bug.cgi?id=15731 7 8 * bindings/js/kjs_window.cpp: 9 (KJS::Window::installTimeout): Avoid putting in or accessing empty or deleted keys. 10 (KJS::Window::clearTimeout): ditto 11 * manual-tests/bad-clearTimeout-crash.html: Added. Automated test not possible. 12 1 13 2007-10-28 Kevin Ollivier <kevino@theolliviers.com> 2 14 -
trunk/WebCore/bindings/js/kjs_window.cpp
r27118 r27196 1522 1522 { 1523 1523 int timeoutId = ++lastUsedTimeoutId; 1524 1525 // avoid wraparound going negative on us 1526 if (timeoutId <= 0) 1527 timeoutId = 1; 1528 1524 1529 int nestLevel = timerNestingLevel + 1; 1525 1530 DOMWindowTimer* timer = new DOMWindowTimer(timeoutId, nestLevel, this, a); … … 1593 1598 void Window::clearTimeout(int timeoutId, bool delAction) 1594 1599 { 1600 // timeout IDs have to be positive, and 0 and -1 are unsafe to 1601 // even look up since they are the empty and deleted value 1602 // respectively 1603 if (timeoutId <= 0) 1604 return; 1605 1595 1606 WindowPrivate::TimeoutsMap::iterator it = d->m_timeouts.find(timeoutId); 1596 1607 if (it == d->m_timeouts.end())
Note:
See TracChangeset
for help on using the changeset viewer.