# Another GD patch

- Thread: https://externals.io/message/627
- Original archive: https://news-web.php.net/php.internals/627
- Started by John Coggeshall on 2003-04-03T06:03:06+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #627 — John Coggeshall — 2003-04-03T06:03:06+00:00

URL: https://externals.io/message/627#627

Here's another small little patch to fix imagepsextendfont() that sanity
checks the $extend parameter to make sure it's greater than zero.
Although less than zero "works" (i.e. it doesn't crash anything) it
really shouldn't be allowed. 

John

-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org                  http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-

Index: gd.c
===================================================================
RCS file: /repository/php4/ext/gd/gd.c,v
retrieving revision 1.261
diff -u -r1.261 gd.c
--- gd.c	31 Mar 2003 08:49:19 -0000	1.261
+++ gd.c	3 Apr 2003 05:54:56 -0000
@@ -3339,6 +3325,11 @@
 	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;
+	}
