You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug summary
When a TrueType font lacks the last expected table (prep), an unbounded number of bytes is read from ptr in order to find it. The search only stops by chance if the bytes beyond the allocated table directory compare (strncmp) equal to or are greater than the sought for table name.
In rare cases (for example if the same memory location previously stored a larger font table directory), the search might find a matching table name and uses checksum, offset and length of the previously processed font. This leads
to an exception when offset and length go beyond the current font file size,
to corrupted output when the current font file satisfies offset and length requirements, or
to an exception if the value oflength is too large.
In principle, this can also cause a segmentation fault.
I think the library should not trust the font files and depend on the existence of the prep tables.
Code for reproduction
The following snippet involves a TrueType font with only 6 of the 9 required tables lacking prep and therefore exhibits the above error.
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug summary
When a TrueType font lacks the last expected table (
prep
), an unbounded number of bytes is read fromptr
in order to find it. The search only stops by chance if the bytes beyond the allocated table directory compare (strncmp
) equal to or are greater than the sought for table name.In rare cases (for example if the same memory location previously stored a larger font table directory), the search might find a matching table name and uses
checksum
,offset
andlength
of the previously processed font. This leadslength
is too large.In principle, this can also cause a segmentation fault.
I think the library should not trust the font files and depend on the existence of the
prep
tables.Code for reproduction
The following snippet involves a TrueType font with only 6 of the 9 required tables lacking
prep
and therefore exhibits the above error.Please note, the above snippet also triggers another issue #20612. After including this fix alone, the resulting EPS is still broken.
Matplotlib version
import matplotlib; print(matplotlib.__version__)
): 3.4.2print(matplotlib.get_backend())
): TkAgg (but actually PS)The text was updated successfully, but these errors were encountered: