[gtk-osx] Fix crash in pango's CoreText backend



commit a4d4e09b364fd2ea5d801f0710045aacaf696b65
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Dec 26 17:51:46 2011 +0100

    Fix crash in pango's CoreText backend
    
    Backport of my fix to bgo#666856

 modulesets-stable/gtk-osx.modules                  |    1 +
 ...-CoreText-fix-zero-width-space-bgo-666856.patch |   47 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx.modules b/modulesets-stable/gtk-osx.modules
index 6e7a0fb..b998b61 100644
--- a/modulesets-stable/gtk-osx.modules
+++ b/modulesets-stable/gtk-osx.modules
@@ -148,6 +148,7 @@
             hash="sha256:f15deecaecf1e9dcb7db0e4947d12b5bcff112586434f8d30a5afd750747ff2b">
       <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/pangoatsui-fontname.patch"; strip="1"/>
       <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/0001-Make-ATSUI-backend-compile-again.patch"; strip="1"/>
+      <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/pango-CoreText-fix-zero-width-space-bgo-666856.patch"; strip="1"/>
     </branch>
     <dependencies>
       <dep package="cairo"/>
diff --git a/patches/pango-CoreText-fix-zero-width-space-bgo-666856.patch b/patches/pango-CoreText-fix-zero-width-space-bgo-666856.patch
new file mode 100644
index 0000000..7b4b481
--- /dev/null
+++ b/patches/pango-CoreText-fix-zero-width-space-bgo-666856.patch
@@ -0,0 +1,47 @@
+From 6088e1430823a312b86b0ca24e34d6746206fbbb Mon Sep 17 00:00:00 2001
+From: Philip Chimento <philip chimento gmail com>
+Date: Mon, 26 Dec 2011 12:23:00 +0100
+Subject: [PATCH] CoreText: fix zero-width space (bgo #666856)
+
+Pango crashes if the CoreText backend tries to render a string
+containing only a zero-width space. Fixes bgo#666856.
+---
+ modules/basic/basic-coretext.c |   21 ++++++++++++++++-----
+ 1 files changed, 16 insertions(+), 5 deletions(-)
+
+diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
+index 8dc3dba..39f7390 100644
+--- a/modules/basic/basic-coretext.c
++++ b/modules/basic/basic-coretext.c
+@@ -121,12 +121,23 @@ basic_engine_shape (PangoEngineShape    *engine,
+   runs = CTLineGetGlyphRuns (line);
+ 
+   /* Since Pango divides things into runs already, we assume there is
+-   * only a single run in this line.
++   * only a single run in this line, unless there are none at all.
+    */
+-  run = CFArrayGetValueAtIndex (runs, 0);
+-  run_status = CTRunGetStatus (run);
+-  glyph_count = CTRunGetGlyphCount (run);
+-  cgglyphs = CTRunGetGlyphsPtr (run);
++  if(CFArrayGetCount(runs) == 0)
++    {
++      /* This happens if text is a single zero-width space (E2 80 8B)
++       * and possibly in other cases? */
++      run_status = kCTRunStatusNoStatus;
++      glyph_count = 0;
++      cgglyphs = NULL;
++    }
++  else
++    {
++      run = CFArrayGetValueAtIndex (runs, 0);
++      run_status = CTRunGetStatus (run);
++      glyph_count = CTRunGetGlyphCount (run);
++      cgglyphs = CTRunGetGlyphsPtr (run);
++    }
+ 
+   p = text;
+   pango_glyph_string_set_size (glyphs, glyph_count);
+-- 
+1.7.3.2
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]