[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master e1f364e 64/68: [woff2] Fix memory leak.
From: |
Werner Lemberg |
Subject: |
[freetype2] master e1f364e 64/68: [woff2] Fix memory leak. |
Date: |
Fri, 5 Mar 2021 09:29:45 -0500 (EST) |
branch: master
commit e1f364e5097008c845f1963f938b6e8adab5e4e6
Author: Werner Lemberg <wl@gnu.org>
Commit: Werner Lemberg <wl@gnu.org>
[woff2] Fix memory leak.
Reported as
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28148
* src/sfnt/sfwoff2.c (woff2_open_font): Reject fonts that have
multiple tables with the same tag. While not explicitly forbidden
in the OpenType specification, it is implicitly forbidden by
describing a binary search algorithm for tables that only works
reliably if table tags are unique.
---
ChangeLog | 14 ++++++++++++++
src/sfnt/sfwoff2.c | 19 +++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 59919e7..7945b1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2021-02-25 Werner Lemberg <wl@gnu.org>
+
+ [woff2] Fix memory leak.
+
+ Reported as
+
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28148
+
+ * src/sfnt/sfwoff2.c (woff2_open_font): Reject fonts that have
+ multiple tables with the same tag. While not explicitly forbidden
+ in the OpenType specification, it is implicitly forbidden by
+ describing a binary search algorithm for tables that only works
+ reliably if table tags are unique.
+
2021-02-22 Werner Lemberg <wl@gnu.org>
* CMakeLists.txt: Update location of `LICENSE.TXT`.
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index 2fe7f47..edf173d 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -2208,6 +2208,25 @@
sizeof ( WOFF2_Table ),
compare_tags );
+ /* reject fonts that have multiple tables with the same tag */
+ for ( nn = 1; nn < woff2.num_tables; nn++ )
+ {
+ FT_ULong tag = indices[nn]->Tag;
+
+
+ if ( tag == indices[nn - 1]->Tag )
+ {
+ FT_ERROR(( "woff2_open_font:"
+ " multiple tables with tag `%c%c%c%c'.\n",
+ (FT_Char)( tag >> 24 ),
+ (FT_Char)( tag >> 16 ),
+ (FT_Char)( tag >> 8 ),
+ (FT_Char)( tag ) ));
+ error = FT_THROW( Invalid_Table );
+ goto Exit;
+ }
+ }
+
if ( woff2.uncompressed_size < 1 )
{
error = FT_THROW( Invalid_Table );
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master e1f364e 64/68: [woff2] Fix memory leak.,
Werner Lemberg <=