< prev index next >

src/java.desktop/share/native/libfontmanager/layout/LigatureSubstProc2.cpp

Print this page
rev 15133 : 8161923: Fix two memory issues.
Reviewed-by: vadim


 132             offset = action & lafComponentOffsetMask;
 133             if (offset != 0) {
 134                 if(componentGlyph >= glyphStorage.getGlyphCount()) {
 135                   LE_DEBUG_BAD_FONT("preposterous componentGlyph");
 136                   currGlyph+= dir;
 137                   return nextStateIndex; // get out! bad font
 138                 }
 139                 i += SWAPW(componentTable(LE_GET_GLYPH(glyphStorage[componentGlyph]) + (SignExtend(offset, lafComponentOffsetMask)),success));
 140                 if (LE_FAILURE(success)) {
 141                     currGlyph+= dir;
 142                     return nextStateIndex;
 143                 }
 144 
 145                 if (action & (lafLast | lafStore))  {
 146                   TTGlyphID ligatureGlyph = SWAPW(ligatureTable(i,success));
 147                   if (LE_FAILURE(success)) {
 148                       currGlyph+= dir;
 149                       return nextStateIndex;
 150                   }
 151                     glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph);
 152                     if(mm==nComponents) {

 153                       LE_DEBUG_BAD_FONT("exceeded nComponents");
 154                       mm--; // don't overrun the stack.
 155                     }
 156                     stack[++mm] = componentGlyph;
 157                     i = 0;
 158                 } else {
 159                     glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF);
 160                 }
 161             }
 162 #if LE_ASSERT_BAD_FONT
 163             if(m<0) {
 164               LE_DEBUG_BAD_FONT("m<0")
 165             }
 166 #endif
 167         } while (LE_SUCCESS(success) && !(action & lafLast) && (m>=0) ); // stop if last bit is set, or if run out of items
 168 
 169         while (mm >= 0) {
 170             if (++m >= nComponents) {
 171                 m = 0;
 172             }
 173 
 174             componentStack[m] = stack[mm--];
 175         }
 176     }


 132             offset = action & lafComponentOffsetMask;
 133             if (offset != 0) {
 134                 if(componentGlyph >= glyphStorage.getGlyphCount()) {
 135                   LE_DEBUG_BAD_FONT("preposterous componentGlyph");
 136                   currGlyph+= dir;
 137                   return nextStateIndex; // get out! bad font
 138                 }
 139                 i += SWAPW(componentTable(LE_GET_GLYPH(glyphStorage[componentGlyph]) + (SignExtend(offset, lafComponentOffsetMask)),success));
 140                 if (LE_FAILURE(success)) {
 141                     currGlyph+= dir;
 142                     return nextStateIndex;
 143                 }
 144 
 145                 if (action & (lafLast | lafStore))  {
 146                     TTGlyphID ligatureGlyph = SWAPW(ligatureTable(i,success));
 147                     if (LE_FAILURE(success)) {
 148                         currGlyph+= dir;
 149                         return nextStateIndex;
 150                     }
 151                     glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph);
 152                     ++mm;
 153                     if (mm == nComponents) {
 154                       LE_DEBUG_BAD_FONT("exceeded nComponents");
 155                       mm--; // don't overrun the stack.
 156                     }
 157                     stack[mm] = componentGlyph;
 158                     i = 0;
 159                 } else {
 160                     glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], 0xFFFF);
 161                 }
 162             }
 163 #if LE_ASSERT_BAD_FONT
 164             if(m<0) {
 165               LE_DEBUG_BAD_FONT("m<0")
 166             }
 167 #endif
 168         } while (LE_SUCCESS(success) && !(action & lafLast) && (m>=0) ); // stop if last bit is set, or if run out of items
 169 
 170         while (mm >= 0) {
 171             if (++m >= nComponents) {
 172                 m = 0;
 173             }
 174 
 175             componentStack[m] = stack[mm--];
 176         }
 177     }
< prev index next >