Bug 1248551 - Add assertion to confirm that the bidi code is not trying to execute an invalid state-machine action. r=roc
authorJonathan Kew <jkew@mozilla.com>
Wed, 17 Feb 2016 21:41:43 +0000
changeset 284638 28b6f5924ce2296a626a573a06cb4be4cfd125cd
parent 284637 9ecae2e500e4404ab3fd59a1cd3d94d38bdf011c
child 284639 f9f9d3a5a3304e9ba4b524a7bd9185c346fdea91
push id30008
push usercbook@mozilla.com
push dateThu, 18 Feb 2016 11:01:39 +0000
treeherdermozilla-central@1150ac4755c7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1248551
milestone47.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 1248551 - Add assertion to confirm that the bidi code is not trying to execute an invalid state-machine action. r=roc
layout/base/nsBidi.cpp
--- a/layout/base/nsBidi.cpp
+++ b/layout/base/nsBidi.cpp
@@ -1436,16 +1436,17 @@ void nsBidi::ProcessPropertySeq(LevState
 
   if(actionSeq) {
     switch(actionSeq) {
     case 1:                         /* init ON seq */
       pLevState->startON = start0;
       break;
 
     case 2:                         /* prepend ON seq to current seq */
+      MOZ_ASSERT(pLevState->startON >= 0, "no valid ON sequence start!");
       start = pLevState->startON;
       break;
 
     default:                        /* we should never get here */
       MOZ_ASSERT(false);
       break;
     }
   }
@@ -1484,16 +1485,17 @@ void nsBidi::ResolveImplicitLevels(int32
   uint16_t oldStateImp, stateImp, actionImp;
   uint8_t gprop, resProp, cell;
 
   /* initialize for property and levels state tables */
   levState.runStart = aStart;
   levState.runLevel = mLevels[aStart];
   levState.pImpTab = impTab[levState.runLevel & 1];
   levState.pImpAct = impAct0;
+  levState.startON = -1; /* initialize to invalid start position */
 
   /* The isolates[] entries contain enough information to
      resume the bidi algorithm in the same state as it was
      when it was interrupted by an isolate sequence. */
   if (dirProps[aStart] == PDI && mIsolateCount >= 0) {
     start1 = mIsolates[mIsolateCount].start1;
     stateImp = mIsolates[mIsolateCount].stateImp;
     levState.state = mIsolates[mIsolateCount].state;