Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType
Commits:
-
5f131cfd
by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-21T16:24:43-04:00
2 changed files:
Changes:
... | ... | @@ -1202,17 +1202,21 @@ |
1202 | 1202 | {
|
1203 | 1203 | CFF_AxisCoords* axis = ®ion->axisList[j];
|
1204 | 1204 | |
1205 | - FT_Int16 start14, peak14, end14;
|
|
1205 | + FT_Int start, peak, end;
|
|
1206 | 1206 | |
1207 | 1207 | |
1208 | - if ( FT_READ_SHORT( start14 ) ||
|
|
1209 | - FT_READ_SHORT( peak14 ) ||
|
|
1210 | - FT_READ_SHORT( end14 ) )
|
|
1208 | + if ( FT_READ_SHORT( start ) ||
|
|
1209 | + FT_READ_SHORT( peak ) ||
|
|
1210 | + FT_READ_SHORT( end ) )
|
|
1211 | 1211 | goto Exit;
|
1212 | 1212 | |
1213 | - axis->startCoord = FT_fdot14ToFixed( start14 );
|
|
1214 | - axis->peakCoord = FT_fdot14ToFixed( peak14 );
|
|
1215 | - axis->endCoord = FT_fdot14ToFixed( end14 );
|
|
1213 | + /* immediately tag invalid ranges with special peak = 0 */
|
|
1214 | + if ( ( start < 0 && end > 0 ) || start > peak || peak > end )
|
|
1215 | + peak = 0;
|
|
1216 | + |
|
1217 | + axis->startCoord = FT_fdot14ToFixed( start );
|
|
1218 | + axis->peakCoord = FT_fdot14ToFixed( peak );
|
|
1219 | + axis->endCoord = FT_fdot14ToFixed( end );
|
|
1216 | 1220 | }
|
1217 | 1221 | }
|
1218 | 1222 | |
... | ... | @@ -1498,19 +1502,11 @@ |
1498 | 1502 | |
1499 | 1503 | |
1500 | 1504 | /* compute the scalar contribution of this axis */
|
1501 | - /* while running mandatory range checks */
|
|
1505 | + /* with peak of 0 used for invalid axes */
|
|
1502 | 1506 | if ( axis->peakCoord == NDV[j] ||
|
1503 | 1507 | axis->peakCoord == 0 )
|
1504 | 1508 | continue;
|
1505 | 1509 | |
1506 | - else if ( axis->startCoord < 0 &&
|
|
1507 | - axis->endCoord > 0 )
|
|
1508 | - continue;
|
|
1509 | - |
|
1510 | - else if ( axis->startCoord > axis->peakCoord ||
|
|
1511 | - axis->peakCoord > axis->endCoord )
|
|
1512 | - continue;
|
|
1513 | - |
|
1514 | 1510 | /* ignore this region if coords are out of range */
|
1515 | 1511 | else if ( NDV[j] <= axis->startCoord ||
|
1516 | 1512 | NDV[j] >= axis->endCoord )
|
... | ... | @@ -596,7 +596,7 @@ |
596 | 596 | |
597 | 597 | for ( j = 0; j < itemStore->axisCount; j++ )
|
598 | 598 | {
|
599 | - FT_Short start, peak, end;
|
|
599 | + FT_Int start, peak, end;
|
|
600 | 600 | |
601 | 601 | |
602 | 602 | if ( FT_READ_SHORT( start ) ||
|
... | ... | @@ -604,6 +604,10 @@ |
604 | 604 | FT_READ_SHORT( end ) )
|
605 | 605 | goto Exit;
|
606 | 606 | |
607 | + /* immediately tag invalid ranges with special peak = 0 */
|
|
608 | + if ( ( start < 0 && end > 0 ) || start > peak || peak > end )
|
|
609 | + peak = 0;
|
|
610 | + |
|
607 | 611 | axisCoords[j].startCoord = FT_fdot14ToFixed( start );
|
608 | 612 | axisCoords[j].peakCoord = FT_fdot14ToFixed( peak );
|
609 | 613 | axisCoords[j].endCoord = FT_fdot14ToFixed( end );
|
... | ... | @@ -1078,19 +1082,11 @@ |
1078 | 1082 | |
1079 | 1083 | |
1080 | 1084 | /* compute the scalar contribution of this axis */
|
1081 | - /* while running mandatory range checks */
|
|
1085 | + /* with peak of 0 used for invalid axes */
|
|
1082 | 1086 | if ( axis->peakCoord == ncv ||
|
1083 | 1087 | axis->peakCoord == 0 )
|
1084 | 1088 | continue;
|
1085 | 1089 | |
1086 | - else if ( axis->startCoord < 0 &&
|
|
1087 | - axis->endCoord > 0 )
|
|
1088 | - continue;
|
|
1089 | - |
|
1090 | - else if ( axis->startCoord > axis->peakCoord ||
|
|
1091 | - axis->peakCoord > axis->endCoord )
|
|
1092 | - continue;
|
|
1093 | - |
|
1094 | 1090 | /* ignore this region if coords are out of range */
|
1095 | 1091 | else if ( ncv <= axis->startCoord ||
|
1096 | 1092 | ncv >= axis->endCoord )
|