sniper Thu Apr 3 19:09:23 2003 EDT Modified files: /php4/ext/gd gd.c Log: - Better errors for T1lib. - Sanity check into imagepsextendfont(). # Patches by John Coggeshall <[EMAIL PROTECTED]> Index: php4/ext/gd/gd.c diff -u php4/ext/gd/gd.c:1.263 php4/ext/gd/gd.c:1.264 --- php4/ext/gd/gd.c:1.263 Thu Apr 3 18:10:08 2003 +++ php4/ext/gd/gd.c Thu Apr 3 19:09:23 2003 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.263 2003/04/03 23:10:08 sniper Exp $ */ +/* $Id: gd.c,v 1.264 2003/04/04 00:09:23 sniper Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -3198,21 +3198,7 @@ f_ind = T1_AddFont(Z_STRVAL_PP(file)); if (f_ind < 0) { - switch (f_ind) { - case -1: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find the font file"); - RETURN_FALSE; - break; - case -2: - case -3: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Memory allocation fault in t1lib"); - RETURN_FALSE; - break; - default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred in t1lib"); - RETURN_FALSE; - break; - } + php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(f_ind)); } if (T1_LoadFont(f_ind)) { @@ -3349,6 +3335,12 @@ ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font); T1_DeleteAllSizes(*f_ind); + + if (Z_DVAL_PP(ext) <= 0) { + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Second parameter %f out of range (must be > 0)", Z_DVAL_PP(ext)); + RETURN_FALSE; + } + if (T1_ExtendFont(*f_ind, Z_DVAL_PP(ext)) != 0) { RETURN_FALSE; } @@ -3486,7 +3478,7 @@ if (!str_path) { if (T1_errno) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno)); } RETURN_FALSE; } @@ -3505,7 +3497,7 @@ str_img = T1_AAFillOutline(str_path, 0); if (T1_errno) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "T1Lib Error: %s", T1_StrError(T1_errno)); RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php