ofz: measure maximum possible contours
Change-Id: Ie039abd835fef06514edde12b99e17360f5481a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130731 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
parent
2195e03808
commit
2ca987b1a9
1 changed files with 8 additions and 2 deletions
|
@ -348,7 +348,13 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI
|
|||
if (glyphID >= ttf->glyphCount())
|
||||
return 0;
|
||||
|
||||
const sal_uInt8* ptr = table + ttf->glyphOffset(glyphID);
|
||||
sal_uInt32 nGlyphOffset = ttf->glyphOffset(glyphID);
|
||||
if (nGlyphOffset > nTableSize)
|
||||
return 0;
|
||||
|
||||
const sal_uInt8* ptr = table + nGlyphOffset;
|
||||
const sal_uInt32 nMaxGlyphSize = nTableSize - nGlyphOffset;
|
||||
|
||||
const sal_Int16 numberOfContours = GetInt16(ptr, GLYF_numberOfContours_offset);
|
||||
if( numberOfContours <= 0 ) /*- glyph is not simple */
|
||||
return 0;
|
||||
|
@ -363,7 +369,7 @@ static int GetSimpleTTOutline(AbstractTrueTypeFont const *ttf, sal_uInt32 glyphI
|
|||
|
||||
/* determine the last point and be extra safe about it. But probably this code is not needed */
|
||||
sal_uInt16 lastPoint=0;
|
||||
const sal_Int32 nMaxContours = (nTableSize - 10)/2;
|
||||
const sal_Int32 nMaxContours = (nMaxGlyphSize - 10)/2;
|
||||
if (numberOfContours > nMaxContours)
|
||||
return 0;
|
||||
for (i=0; i<numberOfContours; i++)
|
||||
|
|
Loading…
Reference in a new issue