< prev index next >

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

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


 133               if(componentGlyph >= glyphStorage.getGlyphCount()) {
 134                 LE_DEBUG_BAD_FONT("preposterous componentGlyph");
 135                 currGlyph++;
 136                 return newState; // get out! bad font
 137               }
 138               i += SWAPW(offsetTable.getObject(LE_GET_GLYPH(glyphStorage[componentGlyph]), success));
 139               if (LE_FAILURE(success)) {
 140                   currGlyph++;
 141                   return newState;
 142               }
 143 
 144                 if (action & (lafLast | lafStore))  {
 145                   LEReferenceTo<TTGlyphID> ligatureOffset(stHeader, success, i);
 146                   if (LE_FAILURE(success)) {
 147                       currGlyph++;
 148                       return newState;
 149                   }
 150                   TTGlyphID ligatureGlyph = SWAPW(*ligatureOffset.getAlias());
 151 
 152                   glyphStorage[componentGlyph] = LE_SET_GLYPH(glyphStorage[componentGlyph], ligatureGlyph);
 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 (!(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     }


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