Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType
Commits:
-
36a905e1
by Alexei Podtelezhnikov at 2021-11-26T09:15:46-05:00
1 changed file:
Changes:
... | ... | @@ -555,7 +555,7 @@ |
555 | 555 |
if ( record_size >= 0xFFFF0000UL )
|
556 | 556 |
record_size &= 0xFFFFU;
|
557 | 557 |
|
558 |
- FT_TRACE2(( "Hdmx ", num_records, record_size ));
|
|
558 |
+ FT_TRACE2(( "Hdmx " ));
|
|
559 | 559 |
|
560 | 560 |
/* The limit for `num_records' is a heuristic value. */
|
561 | 561 |
if ( num_records > 255 || num_records == 0 )
|
... | ... | @@ -564,18 +564,21 @@ |
564 | 564 |
goto Fail;
|
565 | 565 |
}
|
566 | 566 |
|
567 |
- /* Out-of-spec tables are rejected. */
|
|
568 |
- if ( (FT_Long)record_size != ( ( face->root.num_glyphs + 5 ) & ~3 ) )
|
|
567 |
+ /* Out-of-spec tables are rejected. The record size must be */
|
|
568 |
+ /* equal to the number of glyphs + 2 + 32-bit padding. */
|
|
569 |
+ if ( (FT_Long)record_size != ( ( face->root.num_glyphs + 2 + 3 ) & ~3 ) )
|
|
569 | 570 |
{
|
570 | 571 |
FT_TRACE2(( "with record size off by %ld bytes rejected\n",
|
571 |
- (FT_Long)record_size -
|
|
572 |
- ( ( face->root.num_glyphs + 5 ) & ~3 ) ));
|
|
572 |
+ (FT_Long)record_size -
|
|
573 |
+ ( ( face->root.num_glyphs + 2 + 3 ) & ~3 ) ));
|
|
573 | 574 |
goto Fail;
|
574 | 575 |
}
|
575 | 576 |
|
576 | 577 |
if ( FT_QNEW_ARRAY( face->hdmx_record_sizes, num_records ) )
|
577 | 578 |
goto Fail;
|
578 | 579 |
|
580 |
+ /* XXX: We do not check if the records are sorted by ppem */
|
|
581 |
+ /* and cannot use binary search later. */
|
|
579 | 582 |
for ( nn = 0; nn < num_records; nn++ )
|
580 | 583 |
{
|
581 | 584 |
if ( p + record_size > limit )
|