Changeset 94824 in webkit


Ignore:
Timestamp:
Sep 8, 2011 6:14:50 PM (13 years ago)
Author:
adamk@chromium.org
Message:

Always zero-out m_sortedTextBoxesPosition to avoid uninitialized read in TextIterator
https://bugs.webkit.org/show_bug.cgi?id=67810

Reviewed by Tony Chang.

Reported as a valgrind failure in http://crbug.com/84777.

No possible change in behavior, so no tests. The unitialized read
could never have an impact:

if (m_sortedTextBoxesPosition + 1 < m_sortedTextBoxes.size()) ...

Since m_sortedTextBoxes.size() will be zero here if
m_sortedTextBoxesPosition is uninitialized, and they're both unsigned,
so no possible value of m_sortedTextBoxesPosition could be < 0.

  • editing/TextIterator.cpp:

(WebCore::TextIterator::TextIterator):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94823 r94824  
     12011-09-08  Adam Klein  <adamk@chromium.org>
     2
     3        Always zero-out m_sortedTextBoxesPosition to avoid uninitialized read in TextIterator
     4        https://bugs.webkit.org/show_bug.cgi?id=67810
     5
     6        Reviewed by Tony Chang.
     7
     8        Reported as a valgrind failure in http://crbug.com/84777.
     9
     10        No possible change in behavior, so no tests. The unitialized read
     11        could never have an impact:
     12
     13           if (m_sortedTextBoxesPosition + 1 < m_sortedTextBoxes.size()) ...
     14
     15        Since m_sortedTextBoxes.size() will be zero here if
     16        m_sortedTextBoxesPosition is uninitialized, and they're both unsigned,
     17        so no possible value of m_sortedTextBoxesPosition could be < 0.
     18
     19        * editing/TextIterator.cpp:
     20        (WebCore::TextIterator::TextIterator):
     21
    1222011-09-08  Tony Chang  <tony@chromium.org>
    223
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r93347 r94824  
    254254    , m_firstLetterText(0)
    255255    , m_lastCharacter(0)
     256    , m_sortedTextBoxesPosition(0)
    256257    , m_emitsCharactersBetweenAllVisiblePositions(false)
    257258    , m_entersTextControls(false)
     
    273274    , m_remainingTextBox(0)
    274275    , m_firstLetterText(0)
     276    , m_sortedTextBoxesPosition(0)
    275277    , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCharactersBetweenAllVisiblePositions)
    276278    , m_entersTextControls(behavior & TextIteratorEntersTextControls)
Note: See TracChangeset for help on using the changeset viewer.