Bug 717178. Part 1: Don't crash when passing a nil scaled-font to _name_tables_match. r=jfkthame
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 23 Oct 2012 12:37:28 +1300
changeset 111224 40e9ab16d3b23f7e0bb173f78089bf7f754c3032
parent 111223 f0dc54155f65fe63e0392233f6c0c78416deb58d
child 111225 20279718e3c7a6f9f48aa6d4c86e4bf3c7e29af3
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjfkthame
bugs717178
milestone19.0a1
Bug 717178. Part 1: Don't crash when passing a nil scaled-font to _name_tables_match. r=jfkthame
gfx/cairo/README
gfx/cairo/cairo/src/cairo-dwrite-font.cpp
gfx/cairo/dwrite-font-match-robustness.patch
--- a/gfx/cairo/README
+++ b/gfx/cairo/README
@@ -187,17 +187,19 @@ d2d-repeating-gradients.patch: Minimize 
 xlib-glyph-clip-region.patch: bug 709477, addressed upstream by be1ff2f45fdbc69537e513834fcffa0435e63073
 
 gdi-RGB24-ARGB32.patch: bug 788794
 
 dwrite-font-printing.patch: bug 468568; don't substitute a GDI font for a DWrite font if the name tables aren't equal
 
 d2d-gradient-ensure-stops.patch: bug 792903, ensure we don't set num_stops to 0
 
-setlcdfilter_in_tree.patch bug 790139; force cairo to use FT_Library_SetLcdFilter from our in tree library rather than picking it up from the system
+setlcdfilter_in_tree.patch: bug 790139; force cairo to use FT_Library_SetLcdFilter from our in tree library rather than picking it up from the system
+
+dwrite-font-match-robustness.patch: bug 717178, don't crash when _name_tables_match is passed a nil scaled-font
 
 ==== pixman patches ====
 
 pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv.
 
 pixman-rename-and-endian.patch: include cairo-platform.h for renaming of external symbols and endian macros
 
 NOTE: we previously supported ARM assembler on MSVC, this has been removed because of the maintenance burden
--- a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
+++ b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
@@ -1489,17 +1489,18 @@ static cairo_bool_t
     unsigned long size1;
     unsigned long size2;
     cairo_int_status_t status1;
     cairo_int_status_t status2;
     unsigned char *buffer1;
     unsigned char *buffer2;
     cairo_bool_t result = false;
 
-    if (!font1->backend->load_truetype_table ||
+    if (!font1->backend || !font2->backend ||
+        !font1->backend->load_truetype_table ||
         !font2->backend->load_truetype_table)
         return false;
 
     status1 = font1->backend->load_truetype_table (font1,
                                                    TT_TAG_name, 0, NULL, &size1);
     status2 = font2->backend->load_truetype_table (font2,
                                                    TT_TAG_name, 0, NULL, &size2);
     if (status1 || status2)
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/dwrite-font-match-robustness.patch
@@ -0,0 +1,26 @@
+From: Robert O'Callahan <robert@ocallahan.org>
+Bug 717178. Part 1: Don't crash when passing a nil scaled-font to _name_tables_match. r=jfkthame
+
+diff --git a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
+--- a/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
++++ b/gfx/cairo/cairo/src/cairo-dwrite-font.cpp
+@@ -1489,17 +1489,18 @@ static cairo_bool_t
+     unsigned long size1;
+     unsigned long size2;
+     cairo_int_status_t status1;
+     cairo_int_status_t status2;
+     unsigned char *buffer1;
+     unsigned char *buffer2;
+     cairo_bool_t result = false;
+ 
+-    if (!font1->backend->load_truetype_table ||
++    if (!font1->backend || !font2->backend ||
++        !font1->backend->load_truetype_table ||
+         !font2->backend->load_truetype_table)
+         return false;
+ 
+     status1 = font1->backend->load_truetype_table (font1,
+                                                    TT_TAG_name, 0, NULL, &size1);
+     status2 = font2->backend->load_truetype_table (font2,
+                                                    TT_TAG_name, 0, NULL, &size2);
+     if (status1 || status2)