bug 655207 - don't read an uninitialized entry in the hyphenation array. r=roc
authorJonathan Kew <jfkthame@gmail.com>
Mon, 09 May 2011 10:55:19 +0100
changeset 69133 dfcfa00eb188b14330b3d2fbbcd8485a7e3eaa6a
parent 69132 7299264c520460f89d1f47b5c221ad5d18df8c83
child 69134 664382a1d450a7703c416725c3af256615013eb8
push id19874
push userjkew@mozilla.com
push dateMon, 09 May 2011 09:56:23 +0000
treeherdermozilla-central@dfcfa00eb188 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs655207
milestone6.0a1
first release with
nightly win64
dfcfa00eb188 / 6.0a1 / 20110509030216 / files
nightly linux32
nightly linux64
nightly mac
nightly win32
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly win64
bug 655207 - don't read an uninitialized entry in the hyphenation array. r=roc
layout/generic/nsTextFrameThebes.cpp
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -2857,17 +2857,17 @@ PropertyProvider::GetHyphenationBreaks(P
     if (run.IsSkipped()) {
       // Check if there's a soft hyphen which would let us hyphenate before
       // the next non-skipped character. Don't look at soft hyphens followed
       // by other skipped characters, we won't use them.
       allowHyphenBreakBeforeNextChar =
         mFrag->CharAt(run.GetOriginalOffset() + run.GetRunLength() - 1) == CH_SHY;
     } else {
       PRInt32 runOffsetInSubstring = run.GetSkippedOffset() - aStart;
-      memset(aBreakBefore + runOffsetInSubstring, 0, run.GetRunLength());
+      memset(aBreakBefore + runOffsetInSubstring, PR_FALSE, run.GetRunLength());
       // Don't allow hyphen breaks at the start of the line
       aBreakBefore[runOffsetInSubstring] = allowHyphenBreakBeforeNextChar &&
           (!(mFrame->GetStateBits() & TEXT_START_OF_LINE) ||
            run.GetSkippedOffset() > mStart.GetSkippedOffset());
       allowHyphenBreakBeforeNextChar = PR_FALSE;
     }
   }
 
@@ -6148,17 +6148,19 @@ nsTextFrame::AddInlineMinWidthForFlow(ns
                          mTextRun, &tabWidth);
       aData->currentLine = nscoord(afterTab + spacing.mAfter);
       wordStart = i + 1;
     } else if (i < flowEndInTextRun ||
         (i == mTextRun->GetLength() &&
          (mTextRun->GetFlags() & nsTextFrameUtils::TEXT_HAS_TRAILING_BREAK))) {
       if (preformattedNewline) {
         aData->ForceBreak(aRenderingContext);
-      } else if (hyphBreakBefore && hyphBreakBefore[i - start]) {
+      } else if (i < flowEndInTextRun && hyphBreakBefore &&
+                 hyphBreakBefore[i - start])
+      {
         aData->OptionallyBreak(aRenderingContext, provider.GetHyphenWidth());
       } {
         aData->OptionallyBreak(aRenderingContext);
       }
       wordStart = i;
     }
   }