summaryrefslogtreecommitdiff
path: root/external/harfbuzz/62e803b36173fd096d7ad460dd1d1db9be542593.patch.1
blob: 2aef204a26e1a9f30ca8cb29ef3a0ec374a199ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 62e803b36173fd096d7ad460dd1d1db9be542593 Mon Sep 17 00:00:00 2001
From: Behdad Esfahbod <behdad@behdad.org>
Date: Wed, 1 Jun 2022 07:38:21 -0600
Subject: [PATCH] [sbix] Limit glyph extents

Fixes https://github.com/harfbuzz/harfbuzz/issues/3557
---
 src/hb-ot-color-sbix-table.hh       |   6 ++++++
 test/fuzzing/fonts/sbix-extents.ttf | Bin 0 -> 582 bytes
 2 files changed, 6 insertions(+)
 create mode 100644 test/fuzzing/fonts/sbix-extents.ttf

diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh
index 9741ebd450..6efae43cda 100644
--- a/src/hb-ot-color-sbix-table.hh
+++ b/src/hb-ot-color-sbix-table.hh
@@ -298,6 +298,12 @@ struct sbix
 
       const PNGHeader &png = *blob->as<PNGHeader>();
 
+      if (png.IHDR.height >= 65536 || png.IHDR.width >= 65536)
+      {
+	hb_blob_destroy (blob);
+	return false;
+      }
+
       extents->x_bearing = x_offset;
       extents->y_bearing = png.IHDR.height + y_offset;
       extents->width     = png.IHDR.width;