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 331735 28b6f5924ce2296a626a573a06cb4be4cfd125cd
parent 331734 9ecae2e500e4404ab3fd59a1cd3d94d38bdf011c
child 331736 f9f9d3a5a3304e9ba4b524a7bd9185c346fdea91
push id11066
push userbmo:jyavenard@mozilla.com
push dateThu, 18 Feb 2016 05:12:29 +0000
reviewersroc
bugs1248551
milestone47.0a1
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;