Bug 724456. Don't assume that sizeof(bool) == 1 when memsetting arrays of bools in nsLineBreaker. r=bzbarsky
authorCameron Kaiser <spectre@armory.com>
Mon, 06 Feb 2012 13:02:22 -0500
changeset 86249 86dee2f0897bf86c6c162615d30cd5cfc193d4df
parent 86248 b27b65ade4a69842952c3b15cc1b5160a1d08557
child 86250 fb0267222fc4eddee4b9d6ee4e319928398a0e4f
push id22008
push userbmo@edmorley.co.uk
push dateTue, 07 Feb 2012 10:32:58 +0000
treeherdermozilla-central@2b61af9d18ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs724456
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 724456. Don't assume that sizeof(bool) == 1 when memsetting arrays of bools in nsLineBreaker. r=bzbarsky
content/base/src/nsLineBreaker.cpp
--- a/content/base/src/nsLineBreaker.cpp
+++ b/content/base/src/nsLineBreaker.cpp
@@ -201,17 +201,17 @@ nsLineBreaker::AppendText(nsIAtom* aLang
     if (!breakState.AppendElements(aLength))
       return NS_ERROR_OUT_OF_MEMORY;
   }
   
   nsTArray<bool> capitalizationState;
   if (aSink && (aFlags & BREAK_NEED_CAPITALIZATION)) {
     if (!capitalizationState.AppendElements(aLength))
       return NS_ERROR_OUT_OF_MEMORY;
-    memset(capitalizationState.Elements(), false, aLength);
+    memset(capitalizationState.Elements(), false, aLength*sizeof(bool));
   }
 
   PRUint32 start = offset;
   bool noBreaksNeeded = !aSink ||
     (aFlags == (BREAK_SUPPRESS_INITIAL | BREAK_SUPPRESS_INSIDE | BREAK_SKIP_SETTING_NO_BREAKS) &&
      !mBreakHere && !mAfterBreakableSpace);
   if (noBreaksNeeded) {
     // Skip to the space before the last word, since either the break data