File CVE-2012-1144.patch of Package freetype2

From 0fc8debeb6c2f6a8a9a2b97332a7c8a0a1bd9e85 Mon Sep 17 00:00:00 2001
From: Werner Lemberg <wl@gnu.org>
Date: Fri, 02 Mar 2012 15:09:51 +0000
Subject: [truetype] Fix Savannah bug #35689.

* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Check first outline
point.
---
---
 src/truetype/ttgload.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Index: freetype-2.4.4/src/truetype/ttgload.c
===================================================================
--- freetype-2.4.4.orig/src/truetype/ttgload.c
+++ freetype-2.4.4/src/truetype/ttgload.c
@@ -379,14 +379,17 @@
     if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit )
       goto Invalid_Outline;
 
-    prev_cont = FT_NEXT_USHORT( p );
+    prev_cont = FT_NEXT_SHORT( p );
 
     if ( n_contours > 0 )
       cont[0] = prev_cont;
 
+    if ( prev_cont < 0 )
+      goto Invalid_Outline;
+
     for ( cont++; cont < cont_limit; cont++ )
     {
-      cont[0] = FT_NEXT_USHORT( p );
+      cont[0] = FT_NEXT_SHORT( p );
       if ( cont[0] <= prev_cont )
       {
         /* unordered contours: this is invalid */
openSUSE Build Service is sponsored by