Commit e261f426d608d8255dc34793bccda6a2a0915229

Suzuki, Toshiya (鈴木俊哉) 2006-08-15T17:00:43

* src/otvalid/otvmod.c, src/gxvalid/gxvmod.c: replace ft_validator_run by ft_setjmp

diff --git a/ChangeLog b/ChangeLog
index 3d33ae4..08f57da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-08-15  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	`ft_validator_run' wrapping `setjmp' can cause crash, found by Jens:
+	http://lists.nongnu.org/archive/html/freetype-devel/2006-08/msg00004.htm
+
+	* freetype2/src/otvalid/otvmod.c: replace `ft_validator_run' by
+	`ft_setjmp'. It reverts the change introduced on 2005-08-20.
+
+	* freetype2/src/gxvalid/gxvmod.c: Ditto.
+
 2006-08-13  Jens Claudius  <jens.claudius@yahoo.com>
 
 	* freetype2/include/freetype/internal/psaux.h: (enum T1_TokenType_):
diff --git a/src/gxvalid/gxvmod.c b/src/gxvalid/gxvmod.c
index 7bcfef4..c62a63a 100644
--- a/src/gxvalid/gxvmod.c
+++ b/src/gxvalid/gxvmod.c
@@ -91,7 +91,7 @@
           {                                                          \
             ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
                                FT_VALIDATE_DEFAULT );                \
-            if ( ft_validator_run( &valid ) == 0 )                   \
+            if ( ft_setjmp( valid.jump_buffer ) == 0 )               \
               gxv_ ## _sfnt ## _validate( _sfnt, face, &valid );     \
             error = valid.error;                                     \
             if ( error )                                             \
@@ -210,7 +210,7 @@
     {
       ft_validator_init( &valid, ckern, ckern + len_ckern,
                          FT_VALIDATE_DEFAULT );
-      if ( ft_validator_run( &valid ) == 0 )
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
         gxv_kern_validate_classic( ckern, face,
                                    ckern_flags & FT_VALIDATE_CKERN, &valid );
       error = valid.error;
diff --git a/src/otvalid/otvmod.c b/src/otvalid/otvmod.c
index 4c46e6b..58f7eb7 100644
--- a/src/otvalid/otvmod.c
+++ b/src/otvalid/otvmod.c
@@ -124,7 +124,7 @@
     if ( base )
     {
       ft_validator_init( &valid, base, base + len_base, FT_VALIDATE_DEFAULT );
-      if ( ft_validator_run( &valid ) == 0 )
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
         otv_BASE_validate( base, &valid );
       error = valid.error;
       if ( error )
@@ -134,7 +134,7 @@
     if ( gpos )
     {
       ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT );
-      if ( ft_validator_run( &valid ) == 0 )
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
         otv_GPOS_validate( gpos, face->num_glyphs, &valid );
       error = valid.error;
       if ( error )
@@ -144,7 +144,7 @@
     if ( gsub )
     {
       ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT );
-      if ( ft_validator_run( &valid ) == 0 )
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
         otv_GSUB_validate( gsub, face->num_glyphs, &valid );
       error = valid.error;
       if ( error )
@@ -154,7 +154,7 @@
     if ( gdef )
     {
       ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT );
-      if ( ft_validator_run( &valid ) == 0 )
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
         otv_GDEF_validate( gdef, gsub, gpos, &valid );
       error = valid.error;
       if ( error )
@@ -164,7 +164,7 @@
     if ( jstf )
     {
       ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT );
-      if ( ft_validator_run( &valid ) == 0 )
+      if ( ft_setjmp( valid.jump_buffer ) == 0 )
         otv_JSTF_validate( jstf, gsub, gpos, face->num_glyphs, &valid );
       error = valid.error;
       if ( error )