cvs: php4 /ext/gd gd.c

From: Date: Fri, 04 Apr 2003 00:09:23 +0000
Subject: cvs: php4 /ext/gd gd.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-20056@lists.php.net to get a copy of this message
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 <john@coggeshall.org> 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; }

« previous php.cvs (#20056) next »