Commits

medoc committed 531748a

Single Byte charset probers: Fixed off-by-one error in the processing of pair frequency tables

Comments (0)

Files changed (1)

libcharsetdetect/mozilla/extensions/universalchardet/src/base/nsSBCharSetProber.cpp

 
   for (PRUint32 i = 0; i < aLen; i++)
   {
-    order = mModel->charToOrderMap[(unsigned char)aBuf[i]];
+    // Order is in [1-64] but we want 0-63 here. 
+    order = mModel->charToOrderMap[(unsigned char)aBuf[i]] -1;
 
     if (order < SYMBOL_CAT_ORDER)
       mTotalChar++;