Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Sascha Schumann
On Thu, 3 Apr 2003, Derick Rethans wrote:

> On Thu, 3 Apr 2003, Sascha Schumann wrote:
>
> > > Can we please stick to using php_error_docref and try to keep the
> > > descriptions in the same format (ie. with a capital and a point)?
> >
> > I don't think php_error_docref adds value to PHP.
>
> So because *you* dont think so we should do it all different? Come on...

So because *you* think so we should all simply comply? You
must be joking.

Rasmus also already voiced his opposition to this issue.

- Sascha

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/standard basic_functions.c streamsfuncs.c streamsfuncs.h

2003-04-03 Thread Sara Golemon
pollita Fri Apr  4 00:21:03 2003 EDT

  Modified files:  
/php4/ext/standard  basic_functions.c streamsfuncs.c streamsfuncs.h 
  Log:
  Added stream_get_transports()
  
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.604 
php4/ext/standard/basic_functions.c:1.605
--- php4/ext/standard/basic_functions.c:1.604   Thu Apr  3 13:09:41 2003
+++ php4/ext/standard/basic_functions.c Fri Apr  4 00:21:03 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.604 2003/04/03 18:09:41 sas Exp $ */
+/* $Id: basic_functions.c,v 1.605 2003/04/04 05:21:03 pollita Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -701,6 +701,7 @@
PHP_FE(stream_get_line,
 NULL)
PHP_FE(stream_register_wrapper,
 NULL)
PHP_FE(stream_get_wrappers,
 NULL)
+   PHP_FE(stream_get_transports,  
 NULL)
PHP_FE(get_headers,
 NULL)
 
 #if HAVE_SYS_TIME_H || defined(PHP_WIN32)
Index: php4/ext/standard/streamsfuncs.c
diff -u php4/ext/standard/streamsfuncs.c:1.5 php4/ext/standard/streamsfuncs.c:1.6
--- php4/ext/standard/streamsfuncs.c:1.5Tue Mar 18 18:45:27 2003
+++ php4/ext/standard/streamsfuncs.cFri Apr  4 00:21:03 2003
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: streamsfuncs.c,v 1.5 2003/03/18 23:45:27 wez Exp $ */
+/* $Id: streamsfuncs.c,v 1.6 2003/04/04 05:21:03 pollita Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -334,6 +334,33 @@
add_assoc_bool(return_value, "eof", php_stream_eof(stream));
}
 
+}
+/* }}} */
+
+/* {{{ proto array stream_get_transports()
+   Retrieves list of registered socket transports */
+PHP_FUNCTION(stream_get_transports)
+{
+   HashTable *stream_xport_hash;
+   char *stream_xport;
+   int key_flags, stream_xport_len;
+
+   if (ZEND_NUM_ARGS() != 0) {
+   WRONG_PARAM_COUNT;
+   }
+
+   if (stream_xport_hash = php_stream_xport_get_hash()) {
+   array_init(return_value);
+   for(zend_hash_internal_pointer_reset(stream_xport_hash);
+   (key_flags = zend_hash_get_current_key_ex(stream_xport_hash, 
&stream_xport, &stream_xport_len, NULL, 0, NULL)) != HASH_KEY_NON_EXISTANT;
+   zend_hash_move_forward(stream_xport_hash)) {
+   if (key_flags == HASH_KEY_IS_STRING) {
+   add_next_index_stringl(return_value, 
stream_xport, stream_xport_len, 1);
+   }
+   }
+   } else {
+   RETURN_FALSE;
+   }
 }
 /* }}} */
 
Index: php4/ext/standard/streamsfuncs.h
diff -u php4/ext/standard/streamsfuncs.h:1.2 php4/ext/standard/streamsfuncs.h:1.3
--- php4/ext/standard/streamsfuncs.h:1.2Fri Feb 28 20:27:50 2003
+++ php4/ext/standard/streamsfuncs.hFri Apr  4 00:21:03 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: streamsfuncs.h,v 1.2 2003/03/01 01:27:50 wez Exp $ */
+/* $Id: streamsfuncs.h,v 1.3 2003/04/04 05:21:03 pollita Exp $ */
 
 /* Flags for stream_socket_client */
 #define PHP_STREAM_CLIENT_PERSISTENT   1
@@ -34,6 +34,7 @@
 PHP_FUNCTION(stream_select);
 PHP_FUNCTION(stream_set_timeout);
 PHP_FUNCTION(stream_set_write_buffer);
+PHP_FUNCTION(stream_get_transports);
 PHP_FUNCTION(stream_get_wrappers);
 PHP_FUNCTION(stream_get_line);
 PHP_FUNCTION(stream_get_meta_data);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /ext/gd gd.c

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 20:34:08 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/gdgd.c 
  Log:
  MFH
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.221.2.22 php4/ext/gd/gd.c:1.221.2.23
--- php4/ext/gd/gd.c:1.221.2.22 Thu Apr  3 19:16:54 2003
+++ php4/ext/gd/gd.cThu Apr  3 20:34:08 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.221.2.22 2003/04/04 00:16:54 iliaa Exp $ */
+/* $Id: gd.c,v 1.221.2.23 2003/04/04 01:34:08 iliaa Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -2862,7 +2862,7 @@
dstH = Z_LVAL_PP(DH);
dstW = Z_LVAL_PP(DW);

-   if (dstW < 0 || dstH < 0 || srcW < 0 || srcH < 0) {
+   if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
RETURN_FALSE;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 20:33:58 2003 EDT

  Modified files:  
/php4/ext/gdgd.c 
  Log:
  Might as well disallow 0x0 images.
  
  Thanks Marcus.
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.265 php4/ext/gd/gd.c:1.266
--- php4/ext/gd/gd.c:1.265  Thu Apr  3 19:16:47 2003
+++ php4/ext/gd/gd.cThu Apr  3 20:33:57 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.265 2003/04/04 00:16:47 iliaa Exp $ */
+/* $Id: gd.c,v 1.266 2003/04/04 01:33:57 iliaa Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -2947,7 +2947,7 @@
dstH = Z_LVAL_PP(DH);
dstW = Z_LVAL_PP(DW);

-   if (dstW < 0 || dstH < 0 || srcW < 0 || srcH < 0) {
+   if (dstW <= 0 || dstH <= 0 || srcW <= 0 || srcH <= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
RETURN_FALSE;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /main/streams streams.c

2003-04-03 Thread Sara Golemon
pollita Thu Apr  3 20:33:58 2003 EDT

  Modified files:  
/php4/main/streams  streams.c 
  Log:
  Prevent php_stream_get_record from grabbing more than maxlen characters
  
Index: php4/main/streams/streams.c
diff -u php4/main/streams/streams.c:1.16 php4/main/streams/streams.c:1.17
--- php4/main/streams/streams.c:1.16Mon Mar 31 18:22:10 2003
+++ php4/main/streams/streams.c Thu Apr  3 20:33:58 2003
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.16 2003/03/31 23:22:10 moriyoshi Exp $ */
+/* $Id: streams.c,v 1.17 2003/04/04 01:33:58 pollita Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -801,6 +801,10 @@
} else {
toread = e - (char *) stream->readbuf;
}
+   }
+
+   if (toread > maxlen && maxlen > 0) {
+   toread = maxlen;
}
 
buf = emalloc(toread + 1);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 20:17:35 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  Notes about various possible integer overflows in bundled gd library.
  
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.24 php4/TODO_SEGFAULTS:1.1.2.25
--- php4/TODO_SEGFAULTS:1.1.2.24Thu Apr  3 19:44:34 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 20:17:35 2003
@@ -29,6 +29,7 @@
 socket_select   (4)
 php_imagepolygon   (5)
 imagesetstyle  (6)
+bundled gd (7)

 (1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
 this or not might depend on your libc/compiler.  Hard to track down,
@@ -84,6 +85,20 @@
 second argument * sizeof(int) result in an overflow.
 gdImageSetStyle function called by this php wrapper can die for the
 same reason.  
+
+(7) multiple integer overflows that can occur when trying to allocate a buffer
+for a new image. Affected functions:
+gdImageCreateFromJpegCtx
+readwbmp
+gdImageCreateFromXpm
+gdImageCreateFromPngCtx
+gdImagePngCtx
+gdImageCreateFromJpegCtx
+gdImageJpegCtx
+gdImageCreateFromGd2Ctx
+gdImageCreateFromGd2PartCtx
+_gdImageGd2
+GetDataBlock (gd_gif_in.c)
 
 Ammendment 1.
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Ilia A.
On April 3, 2003 07:35 pm, Marcus Börger wrote:
> >+   if (dstW < 0 || dstH < 0 || srcW < 0 || srcH < 0) {
>
> Why is that not <=

Why not indeed...

I'll make the change.

Ilia


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Marcus Börger

+   if (dstW < 0 || dstH < 0 || srcW < 0 || srcH < 0) {
Why is that not <=

marcus

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 19:44:35 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  More gd stuff.
  
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.23 php4/TODO_SEGFAULTS:1.1.2.24
--- php4/TODO_SEGFAULTS:1.1.2.23Thu Apr  3 19:29:37 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 19:44:34 2003
@@ -28,6 +28,7 @@
 chunk_split (3)
 socket_select   (4)
 php_imagepolygon   (5)
+imagesetstyle  (6)

 (1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
 this or not might depend on your libc/compiler.  Hard to track down,
@@ -79,6 +80,10 @@
 (5) integer overflow inside php_imagepolygon and possible subsequent 
 integer overflows inside gdlib's gdImageFilledPolygon().
 
+(6) integer overflow if the number of elements in the array passed as
+second argument * sizeof(int) result in an overflow.
+gdImageSetStyle function called by this php wrapper can die for the
+same reason.  
 
 Ammendment 1.
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 19:29:37 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  Fixed segv as well as info about new segvs in gd.
  
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.22 php4/TODO_SEGFAULTS:1.1.2.23
--- php4/TODO_SEGFAULTS:1.1.2.22Thu Apr  3 15:07:40 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 19:29:37 2003
@@ -9,10 +9,11 @@
 exif_imagetype,exif_thumbnail (Rasmus)
 dbase_open (Rasmus)
 array_pad (Rasmus)
-str_repeat (Ilia)
 setlocale (Rasmus)
 unregister_tick_function (Rasmus)
 bcsub (Rasmus)
+str_repeat (Ilia)
+imagecopyresized (Ilia)
 mb_ereg, mb_ereg_match, mb_eregi, mb_split (Moriyoshi)
 xml_parser_create (Moriyoshi)
 ob_start (Sascha)
@@ -26,6 +27,7 @@
 mb_strcut('', 2147483647);  (2)
 chunk_split (3)
 socket_select   (4)
+php_imagepolygon   (5)

 (1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
 this or not might depend on your libc/compiler.  Hard to track down,
@@ -74,7 +76,8 @@
 
 echo dbase_open | php do_crash.txt
 
-
+(5) integer overflow inside php_imagepolygon and possible subsequent 
+integer overflows inside gdlib's gdImageFilledPolygon().
 
 
 Ammendment 1.



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /ext/gd gd.c

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 19:16:55 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/gdgd.c 
  Log:
  MFH
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.221.2.21 php4/ext/gd/gd.c:1.221.2.22
--- php4/ext/gd/gd.c:1.221.2.21 Thu Apr  3 18:10:17 2003
+++ php4/ext/gd/gd.cThu Apr  3 19:16:54 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.221.2.21 2003/04/03 23:10:17 sniper Exp $ */
+/* $Id: gd.c,v 1.221.2.22 2003/04/04 00:16:54 iliaa Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -2861,6 +2861,11 @@
dstY = Z_LVAL_PP(DY);
dstH = Z_LVAL_PP(DH);
dstW = Z_LVAL_PP(DW);
+   
+   if (dstW < 0 || dstH < 0 || srcW < 0 || srcH < 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
+   RETURN_FALSE;
+   }
 
gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, 
srcH);
RETURN_TRUE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Ilia Alshanetsky
iliaa   Thu Apr  3 19:16:48 2003 EDT

  Modified files:  
/php4/ext/gdgd.c 
  Log:
  Fix segfault in imagecopyresized().
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.264 php4/ext/gd/gd.c:1.265
--- php4/ext/gd/gd.c:1.264  Thu Apr  3 19:09:23 2003
+++ php4/ext/gd/gd.cThu Apr  3 19:16:47 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.264 2003/04/04 00:09:23 sniper Exp $ */
+/* $Id: gd.c,v 1.265 2003/04/04 00:16:47 iliaa Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -2946,6 +2946,11 @@
dstY = Z_LVAL_PP(DY);
dstH = Z_LVAL_PP(DH);
dstW = Z_LVAL_PP(DW);
+   
+   if (dstW < 0 || dstH < 0 || srcW < 0 || srcH < 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
+   RETURN_FALSE;
+   }
 
gdImageCopyResized(im_dst, im_src, dstX, dstY, srcX, srcY, dstW, dstH, srcW, 
srcH);
RETURN_TRUE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Jani Taskinen
sniper  Thu Apr  3 19:09:23 2003 EDT

  Modified files:  
/php4/ext/gdgd.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.cThu 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



[PHP-CVS] cvs: php4(PHP_4_3) /ext/gd gd.c

2003-04-03 Thread Jani Taskinen
sniper  Thu Apr  3 18:10:17 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/gdgd.c 
  Log:
  MFH
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.221.2.20 php4/ext/gd/gd.c:1.221.2.21
--- php4/ext/gd/gd.c:1.221.2.20 Thu Apr  3 14:19:25 2003
+++ php4/ext/gd/gd.cThu Apr  3 18:10:17 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.221.2.20 2003/04/03 19:19:25 sas Exp $ */
+/* $Id: gd.c,v 1.221.2.21 2003/04/03 23:10:17 sniper Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -729,9 +729,8 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
 
-   if (Z_LVAL_PP(x_size) <= 0
-   || Z_LVAL_PP(y_size) <= 0) {
-   php_error(E_WARNING, "invalid image dimensions");
+   if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
RETURN_FALSE;
}

@@ -1174,9 +1173,8 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
 
-   if (Z_LVAL_PP(x_size) <= 0
-   || Z_LVAL_PP(y_size) <= 0) {
-   php_error(E_WARNING, "invalid image dimensions");
+   if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
RETURN_FALSE;
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Jani Taskinen
sniper  Thu Apr  3 18:10:08 2003 EDT

  Modified files:  
/php4/ext/gdgd.c 
  Log:
  Use php_error_docref.
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.262 php4/ext/gd/gd.c:1.263
--- php4/ext/gd/gd.c:1.262  Thu Apr  3 14:18:57 2003
+++ php4/ext/gd/gd.cThu Apr  3 18:10:08 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.262 2003/04/03 19:18:57 sas Exp $ */
+/* $Id: gd.c,v 1.263 2003/04/03 23:10:08 sniper Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -800,9 +800,8 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
 
-   if (Z_LVAL_PP(x_size) <= 0
-   || Z_LVAL_PP(y_size) <= 0) {
-   php_error(E_WARNING, "invalid image dimensions");
+   if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
RETURN_FALSE;
}

@@ -1249,9 +1248,8 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
 
-   if (Z_LVAL_PP(x_size) <= 0
-   || Z_LVAL_PP(y_size) <= 0) {
-   php_error(E_WARNING, "invalid image dimensions");
+   if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
RETURN_FALSE;
}
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/exif exif.c

2003-04-03 Thread Rasmus Lerdorf
rasmus  Thu Apr  3 17:45:26 2003 EDT

  Modified files:  
/php4/ext/exif  exif.c 
  Log:
  MFB
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.142 php4/ext/exif/exif.c:1.143
--- php4/ext/exif/exif.c:1.142  Wed Apr  2 17:07:22 2003
+++ php4/ext/exif/exif.cThu Apr  3 17:45:25 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $ */
+/* $Id: exif.c,v 1.143 2003/04/03 22:45:25 rasmus Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.142 2003/04/02 22:07:22 rasmus Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.143 2003/04/03 22:45:25 rasmus Exp $"
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -3909,19 +3909,22 @@
Reads the embedded thumbnail */
 PHP_FUNCTION(exif_thumbnail)
 {
-   zval **p_name, **p_width, **p_height, **p_imagetype;
-   int ret, arg_c = ZEND_NUM_ARGS();
+   zval *p_width, *p_height, *p_imagetype;
+   char *p_name;
+   int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
image_info_type ImageInfo;
 
memset(&ImageInfo, 0, sizeof(ImageInfo));
 
-   if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, 
&p_name, &p_width, &p_height, &p_imagetype) == FAILURE) {
+   if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
WRONG_PARAM_COUNT;
}
 
-   convert_to_string_ex(p_name);
+   if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, 
&p_width, &p_height, &p_imagetype) == FAILURE) {
+   return;
+   }
 
-   ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
+   ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
if (ret==FALSE) {
RETURN_FALSE;
}
@@ -3943,11 +3946,14 @@
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
}
-   ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
-   ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
+   zval_dtor(p_width);
+   zval_dtor(p_height);
+   ZVAL_LONG(p_width,  ImageInfo.Thumbnail.width);
+   ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
}
if (arg_c >= 4) {
-   ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
+   zval_dtor(p_imagetype);
+   ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
}
 
 #ifdef EXIF_DEBUG
@@ -3957,7 +3963,7 @@
exif_discard_imageinfo(&ImageInfo);
 
 #ifdef EXIF_DEBUG
-   php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done");
+   php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done");
 #endif
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 / configure.in

2003-04-03 Thread Marcus Boerger
helly   Thu Apr  3 15:59:43 2003 EDT

  Modified files:  
/php4   configure.in 
  Log:
  Check for flex version 2.5.4
  
Index: php4/configure.in
diff -u php4/configure.in:1.438 php4/configure.in:1.439
--- php4/configure.in:1.438 Wed Apr  2 16:17:16 2003
+++ php4/configure.in   Thu Apr  3 15:59:42 2003
@@ -1,4 +1,4 @@
-dnl ## $Id: configure.in,v 1.438 2003/04/02 21:17:16 helly Exp $ -*- sh -*-
+dnl ## $Id: configure.in,v 1.439 2003/04/03 20:59:42 helly Exp $ -*- sh -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -160,8 +160,8 @@
sed -e 's/^.* //' -e 's/\./ /g'`
if test ! -z "$flexvers"; then
set $flexvers
-   if test "${1}" != "2" -o "${2}" != "5" -o "${3}" -lt "4"; then
-   AC_MSG_WARN(You will need flex 2.5.4 or later if you want to 
regenerate Zend/PHP lexical parsers.)
+   if test "${1}" != "2" -o "${2}" != "5" -o "${3}" != "4"; then
+   AC_MSG_WARN(You will need flex 2.5.4 if you want to regenerate 
Zend/PHP lexical parsers.)
fi
fi
 AC_MSG_RESULT(${1}.${2}.${3} (ok))



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Derick Rethans
On Thu, 3 Apr 2003, Sascha Schumann wrote:

> > Can we please stick to using php_error_docref and try to keep the
> > descriptions in the same format (ie. with a capital and a point)?
> 
> I don't think php_error_docref adds value to PHP.

So because *you* dont think so we should do it all different? Come on...

Derick

-- 
"my other box is your windows PC"
-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 15:07:40 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  one in socket_select
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.21 php4/TODO_SEGFAULTS:1.1.2.22
--- php4/TODO_SEGFAULTS:1.1.2.21Thu Apr  3 14:46:26 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 15:07:40 2003
@@ -25,6 +25,7 @@
 the dbase extension (1)
 mb_strcut('', 2147483647);  (2)
 chunk_split (3)
+socket_select   (4)

 (1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
 this or not might depend on your libc/compiler.  Hard to track down,
@@ -53,6 +54,7 @@
 
 (3) integer overflow in php_chunk_split
 
+(4) heap corruption, dies in efree()/execute()
 
 Methodology
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /main output.c

2003-04-03 Thread Sascha Schumann
On Thu, 3 Apr 2003, Jani Taskinen wrote:

> sniperThu Apr  3 13:44:00 2003 EDT
>
>   Modified files:
> /php4/mainoutput.c
>   Log:
>   WS & CS fix

Jani, in addition to regularly polluting the CVS history, you
are also desyncing the various branches.  This does not make
the job easier for people who actually work on the source
code.  So, either sync the branches or don't commit this
stuff at all.

- Sascha

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 14:46:26 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  augment summary with fixes which predate the list
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.20 php4/TODO_SEGFAULTS:1.1.2.21
--- php4/TODO_SEGFAULTS:1.1.2.20Thu Apr  3 14:33:55 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 14:46:26 2003
@@ -17,6 +17,8 @@
 xml_parser_create (Moriyoshi)
 ob_start (Sascha)
 imagecreate/-truecolor (Sascha)
+flock (Sascha)
+   register_shutdown_function (Sascha)

 Open:
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 14:33:56 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  add chunk_split
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.19 php4/TODO_SEGFAULTS:1.1.2.20
--- php4/TODO_SEGFAULTS:1.1.2.19Thu Apr  3 14:21:50 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 14:33:55 2003
@@ -22,6 +22,7 @@
 
 the dbase extension (1)
 mb_strcut('', 2147483647);  (2)
+chunk_split (3)

 (1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
 this or not might depend on your libc/compiler.  Hard to track down,
@@ -47,7 +48,10 @@
 at /home/sas/src/php4/ext/mbstring/mbfilter.c:8258
8258(*encoder->filter_function)(*p++, 
encoder TSRMLS_CC);
 
-   
+
+(3) integer overflow in php_chunk_split
+
+
 Methodology
 
 1. Use a plain PHP_4_3 tree



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Sascha Schumann
> Can we please stick to using php_error_docref and try to keep the
> descriptions in the same format (ie. with a capital and a point)?

I don't think php_error_docref adds value to PHP.

- Sascha

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Derick Rethans
On Thu, 3 Apr 2003, Sascha Schumann wrote:

> sas   Thu Apr  3 14:18:58 2003 EDT
> 
>   Modified files:  
> /php4/ext/gd  gd.c 
>   Log:
>   Fix segfaults in imagecreate/imagecreatetruecolor

Can we please stick to using php_error_docref and try to keep the 
descriptions in the same format (ie. with a capital and a point)?

> + if (Z_LVAL_PP(x_size) <= 0
> + || Z_LVAL_PP(y_size) <= 0) {
> + php_error(E_WARNING, "invalid image dimensions");
> + RETURN_FALSE;
> + }
> + 


Derick

-- 
"my other box is your windows PC"
-
 Derick Rethans http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals   http://php-mag.net/
-

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 14:21:50 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  another one fixed, a new one found
  
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.18 php4/TODO_SEGFAULTS:1.1.2.19
--- php4/TODO_SEGFAULTS:1.1.2.18Thu Apr  3 13:55:54 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 14:21:50 2003
@@ -15,11 +15,13 @@
 bcsub (Rasmus)
 mb_ereg, mb_ereg_match, mb_eregi, mb_split (Moriyoshi)
 xml_parser_create (Moriyoshi)
-ob_start (3) (Sascha)
-
+ob_start (Sascha)
+imagecreate/-truecolor (Sascha)
+   
 Open:
 
-the dbase extension(1)
+the dbase extension (1)
+mb_strcut('', 2147483647);  (2)

 (1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
 this or not might depend on your libc/compiler.  Hard to track down,
@@ -38,6 +40,12 @@
 dbase_numrecords
 dbase_open
 X 
+
+(2) backtrace:
+#0  0x080b828e in mbfl_strcut (string=0xbfffbde0, result=0xbfffbdd0, 
+   from=2147483647, length=0)
+at /home/sas/src/php4/ext/mbstring/mbfilter.c:8258
+   8258(*encoder->filter_function)(*p++, 
encoder TSRMLS_CC);
 

 Methodology



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /ext/gd gd.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 14:19:26 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/gdgd.c 
  Log:
  MFH
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.221.2.19 php4/ext/gd/gd.c:1.221.2.20
--- php4/ext/gd/gd.c:1.221.2.19 Mon Mar 31 03:49:30 2003
+++ php4/ext/gd/gd.cThu Apr  3 14:19:25 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.221.2.19 2003/03/31 08:49:30 sniper Exp $ */
+/* $Id: gd.c,v 1.221.2.20 2003/04/03 19:19:25 sas Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
Cold Spring Harbor Labs. */
@@ -729,6 +729,12 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
 
+   if (Z_LVAL_PP(x_size) <= 0
+   || Z_LVAL_PP(y_size) <= 0) {
+   php_error(E_WARNING, "invalid image dimensions");
+   RETURN_FALSE;
+   }
+   
im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
 
ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
@@ -1167,6 +1173,12 @@
 
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
+
+   if (Z_LVAL_PP(x_size) <= 0
+   || Z_LVAL_PP(y_size) <= 0) {
+   php_error(E_WARNING, "invalid image dimensions");
+   RETURN_FALSE;
+   }
 
im = gdImageCreate(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/gd gd.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 14:18:58 2003 EDT

  Modified files:  
/php4/ext/gdgd.c 
  Log:
  Fix segfaults in imagecreate/imagecreatetruecolor
  
  
Index: php4/ext/gd/gd.c
diff -u php4/ext/gd/gd.c:1.261 php4/ext/gd/gd.c:1.262
--- php4/ext/gd/gd.c:1.261  Mon Mar 31 03:49:19 2003
+++ php4/ext/gd/gd.cThu Apr  3 14:18:57 2003
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: gd.c,v 1.261 2003/03/31 08:49:19 sniper Exp $ */
+/* $Id: gd.c,v 1.262 2003/04/03 19:18:57 sas Exp $ */
 
 /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -800,6 +800,12 @@
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
 
+   if (Z_LVAL_PP(x_size) <= 0
+   || Z_LVAL_PP(y_size) <= 0) {
+   php_error(E_WARNING, "invalid image dimensions");
+   RETURN_FALSE;
+   }
+   
im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
 
ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
@@ -1242,6 +1248,12 @@
 
convert_to_long_ex(x_size);
convert_to_long_ex(y_size);
+
+   if (Z_LVAL_PP(x_size) <= 0
+   || Z_LVAL_PP(y_size) <= 0) {
+   php_error(E_WARNING, "invalid image dimensions");
+   RETURN_FALSE;
+   }
 
im = gdImageCreate(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Rasmus Lerdorf
That dbase extension is a trainwreck.  Did you see the code I fixed 
yesterday?  It had:

  cp = (char *)malloc(256);
  strcpy(cp, dp); strcat(cp, ".dbf");

;(

-Rasmus

On Thu, 3 Apr 2003, Sascha Schumann wrote:

> sas   Thu Apr  3 13:52:35 2003 EDT
> 
>   Modified files:  (Branch: PHP_4_3)
> /php4 TODO_SEGFAULTS 
>   Log:
>   update regarding dbase extension
>   
>   
> Index: php4/TODO_SEGFAULTS
> diff -u php4/TODO_SEGFAULTS:1.1.2.16 php4/TODO_SEGFAULTS:1.1.2.17
> --- php4/TODO_SEGFAULTS:1.1.2.16  Thu Apr  3 13:22:14 2003
> +++ php4/TODO_SEGFAULTS   Thu Apr  3 13:52:35 2003
> @@ -6,7 +6,7 @@
>  
>  mb_convert_encoding (Moriyoshi)
>  socket_iovec_alloc (Rasmus)
> -exif_imagetype,exif_thumbnail (Rasmus)
> +exif_thumbnail (Rasmus)
>  dbase_open (Rasmus)
>  array_pad (Rasmus)
>  str_repeat (Ilia)
> @@ -19,8 +19,27 @@
>  
>  Open:
>  
> -none at this time
> +the dbase extension(1)
> + 
> +(1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
> +this or not might depend on your libc/compiler.  Hard to track down,
> +because the result of the corruption might be quite delayed.
>  
> +Reproducable with glibc-2.3/gcc 3.2.2 by:
> + 
> +cat < +dbase_add_record
> +dbase_close
> +dbase_create
> +dbase_delete_record
> +dbase_get_record
> +dbase_get_record_with_names
> +dbase_numfields
> +dbase_numrecords
> +dbase_open
> +X 
> +
> + 
>  Methodology
>  
>  1. Use a plain PHP_4_3 tree
> 
> 
> 
> 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:55:54 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  fix
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.17 php4/TODO_SEGFAULTS:1.1.2.18
--- php4/TODO_SEGFAULTS:1.1.2.17Thu Apr  3 13:52:35 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 13:55:54 2003
@@ -6,7 +6,7 @@
 
 mb_convert_encoding (Moriyoshi)
 socket_iovec_alloc (Rasmus)
-exif_thumbnail (Rasmus)
+exif_imagetype,exif_thumbnail (Rasmus)
 dbase_open (Rasmus)
 array_pad (Rasmus)
 str_repeat (Ilia)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:52:35 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  update regarding dbase extension
  
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.16 php4/TODO_SEGFAULTS:1.1.2.17
--- php4/TODO_SEGFAULTS:1.1.2.16Thu Apr  3 13:22:14 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 13:52:35 2003
@@ -6,7 +6,7 @@
 
 mb_convert_encoding (Moriyoshi)
 socket_iovec_alloc (Rasmus)
-exif_imagetype,exif_thumbnail (Rasmus)
+exif_thumbnail (Rasmus)
 dbase_open (Rasmus)
 array_pad (Rasmus)
 str_repeat (Ilia)
@@ -19,8 +19,27 @@
 
 Open:
 
-none at this time
+the dbase extension(1)
+   
+(1) heap corruption, mostly visible in malloc-related calls.  Whether you see 
+this or not might depend on your libc/compiler.  Hard to track down,
+because the result of the corruption might be quite delayed.
 
+Reproducable with glibc-2.3/gcc 3.2.2 by:
+   
+cat 

[PHP-CVS] cvs: php4 /main output.c

2003-04-03 Thread Jani Taskinen
sniper  Thu Apr  3 13:44:00 2003 EDT

  Modified files:  
/php4/main  output.c 
  Log:
  WS & CS fix
  Index: php4/main/output.c
diff -u php4/main/output.c:1.153 php4/main/output.c:1.154
--- php4/main/output.c:1.153Thu Apr  3 13:19:15 2003
+++ php4/main/output.c  Thu Apr  3 13:44:00 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.153 2003/04/03 18:19:15 sas Exp $ */
+/* $Id: output.c,v 1.154 2003/04/03 18:44:00 sniper Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -151,14 +151,14 @@
return FAILURE;
}
if (chunk_size > 0) {
-   if (chunk_size==1) {
+   if (chunk_size == 1) {
chunk_size = 4096;
}
-   initial_size = (chunk_size*3/2);
-   block_size = chunk_size/2;
+   initial_size = (chunk_size * 3 / 2);
+   block_size = chunk_size / 2;
} else {
-   initial_size = 40*1024;
-   block_size = 10*1024;
+   initial_size = 40 * 1024;
+   block_size = 10 * 1024;
}
return php_ob_init(initial_size, block_size, output_handler, chunk_size, erase 
TSRMLS_CC);
 }
@@ -195,9 +195,10 @@
php_ob_buffer *prev_ob_buffer_p=NULL;
php_ob_buffer orig_ob_buffer;
 
-   if (OG(ob_nesting_level)==0) {
+   if (OG(ob_nesting_level) == 0) {
return;
}
+
status = 0;
if (!OG(active_ob_buffer).status & PHP_OUTPUT_HANDLER_START) {
/* our first call */
@@ -229,8 +230,8 @@
 
ALLOC_INIT_ZVAL(orig_buffer);
ZVAL_STRINGL(orig_buffer, OG(active_ob_buffer).buffer, 
OG(active_ob_buffer).text_length, 1);
-   orig_buffer->refcount=2;/* don't let call_user_function() 
destroy our buffer */
-   orig_buffer->is_ref=1;
+   orig_buffer->refcount = 2;  /* don't let call_user_function() 
destroy our buffer */
+   orig_buffer->is_ref = 1;
 
ALLOC_INIT_ZVAL(z_status);
ZVAL_LONG(z_status, status);
@@ -238,8 +239,8 @@
params[0] = &orig_buffer;
params[1] = &z_status;
OG(ob_lock) = 1;
-   if (call_user_function_ex(CG(function_table), NULL, 
OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL 
TSRMLS_CC)==SUCCESS) {
-   if (!(Z_TYPE_P(alternate_buffer)==IS_BOOL && 
Z_BVAL_P(alternate_buffer)==0)) {
+   if (call_user_function_ex(CG(function_table), NULL, 
OG(active_ob_buffer).output_handler, &alternate_buffer, 2, params, 1, NULL TSRMLS_CC) 
== SUCCESS) {
+   if (!(Z_TYPE_P(alternate_buffer) == IS_BOOL && 
Z_BVAL_P(alternate_buffer) == 0)) {
convert_to_string_ex(&alternate_buffer);
final_buffer = Z_STRVAL_P(alternate_buffer);
final_buffer_length = Z_STRLEN_P(alternate_buffer);
@@ -247,7 +248,7 @@
}
OG(ob_lock) = 0;
zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
-   orig_buffer->refcount -=2;
+   orig_buffer->refcount -= 2;
if (orig_buffer->refcount <= 0) { /* free the zval */
zval_dtor(orig_buffer);
FREE_ZVAL(orig_buffer);
@@ -260,7 +261,7 @@
final_buffer_length = OG(active_ob_buffer).text_length;
}
 
-   if (OG(ob_nesting_level)==1) { /* end buffering */
+   if (OG(ob_nesting_level) == 1) { /* end buffering */
if (SG(headers_sent) && !SG(request_info).headers_only) {
OG(php_body_write) = php_ub_body_write_no_header;
} else {
@@ -281,12 +282,12 @@
to_be_destroyed_handled_output[1] = 
OG(active_ob_buffer).internal_output_handler_buffer;
}
}
-   if (OG(ob_nesting_level)>1) { /* restore previous buffer */
+   if (OG(ob_nesting_level) > 1) { /* restore previous buffer */
zend_stack_top(&OG(ob_buffers), (void **) &prev_ob_buffer_p);
orig_ob_buffer = OG(active_ob_buffer);
OG(active_ob_buffer) = *prev_ob_buffer_p;
zend_stack_del_top(&OG(ob_buffers));
-   if (!just_flush && OG(ob_nesting_level)==2) { /* destroy the stack */
+   if (!just_flush && OG(ob_nesting_level) == 2) { /* destroy the stack */
zend_stack_destroy(&OG(ob_buffers));
}
}
@@ -331,7 +332,7 @@
  * End output buffering (all buffers) */
 PHPAPI void php_end_ob_buffers(zend_bool send_buffer TSRMLS_DC)
 {
-   while (OG(ob_nesting_level)!=0) {
+   while (OG(ob_nesting_level) != 0) {
php_end_ob_buffer(send_buffer, 0 TSRMLS

[PHP-CVS] cvs: php4 /ext/standard array.c

2003-04-03 Thread Sara Golemon
pollita Thu Apr  3 13:33:05 2003 EDT

  Modified files:  
/php4/ext/standard  array.c 
  Log:
  Kludgy fix for floating point drift causing problems like range(1.0,1.5,0.1) == 
array(1.0,1.1,1.2,1.3,1.4);
  
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.224 php4/ext/standard/array.c:1.225
--- php4/ext/standard/array.c:1.224 Tue Apr  1 16:47:21 2003
+++ php4/ext/standard/array.c   Thu Apr  3 13:33:05 2003
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.224 2003/04/01 21:47:21 rasmus Exp $ */
+/* $Id: array.c,v 1.225 2003/04/03 18:33:05 pollita Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -81,6 +81,8 @@
 #define INTERSECT_NORMAL   0
 #define INTERSECT_ASSOC1
 
+#define DOUBLE_DRIFT_FIX   0.001
+
 PHP_MINIT_FUNCTION(array)
 {
 #ifdef ZTS
@@ -1543,7 +1545,7 @@
err = 1;
goto err;
}
-   for (; low >= high; low -= step) {
+   for (; low >= (high - DOUBLE_DRIFT_FIX); low -= step) {
add_next_index_double(return_value, low);
}   
} else if (high > low) {/* Positive steps */
@@ -1551,7 +1553,7 @@
err = 1;
goto err;
}
-   for (; low <= high; low += step) {
+   for (; low <= (high + DOUBLE_DRIFT_FIX); low += step) {
add_next_index_double(return_value, low);
}   
} else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c

2003-04-03 Thread Rasmus Lerdorf
Waiting to see if anybody was going to comment on it or make silly 
whitespace changes first.

On Thu, 3 Apr 2003, Jani Taskinen wrote:

> 
> Shouldn't you MFB this?
> 
> --Jani
> 
> 
> On Thu, 3 Apr 2003, Rasmus Lerdorf wrote:
> 
> >rasmus   Thu Apr  3 10:57:31 2003 EDT
> >
> >  Modified files:  (Branch: PHP_4_3)
> >/php4/ext/exif   exif.c 
> >  Log:
> >  Clean up the parameter handling here
> >  
> >  
> >Index: php4/ext/exif/exif.c
> >diff -u php4/ext/exif/exif.c:1.118.2.15 php4/ext/exif/exif.c:1.118.2.16
> >--- php4/ext/exif/exif.c:1.118.2.15  Wed Apr  2 17:06:46 2003
> >+++ php4/ext/exif/exif.c Thu Apr  3 10:57:30 2003
> >@@ -17,7 +17,7 @@
> >+--+
> >  */
> > 
> >-/* $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ */
> >+/* $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ */
> > 
> > /*  ToDos
> >  *
> >@@ -95,7 +95,7 @@
> > };
> > /* }}} */
> > 
> >-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp 
> >$"
> >+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp 
> >$"
> > 
> > /* {{{ PHP_MINFO_FUNCTION
> >  */
> >@@ -4001,19 +4001,22 @@
> >Reads the embedded thumbnail */
> > PHP_FUNCTION(exif_thumbnail)
> > {
> >-zval **p_name, **p_width, **p_height, **p_imagetype;
> >-int ret, arg_c = ZEND_NUM_ARGS();
> >+zval *p_width, *p_height, *p_imagetype;
> >+char *p_name;
> >+int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
> > image_info_type ImageInfo;
> > 
> > memset(&ImageInfo, 0, sizeof(ImageInfo));
> > 
> >-if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, 
> >&p_name, &p_width, &p_height, &p_imagetype) == FAILURE) {
> >+if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
> > WRONG_PARAM_COUNT;
> > }
> > 
> >-convert_to_string_ex(p_name);
> >+if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, 
> >&p_width, &p_height, &p_imagetype) == FAILURE) {
> >+return;
> >+}
> > 
> >-ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
> >+ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
> > if (ret==FALSE) {
> > RETURN_FALSE;
> > }
> >@@ -4035,11 +4038,14 @@
> > if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
> > exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
> > }
> >-ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
> >-ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
> >+zval_dtor(p_width);
> >+zval_dtor(p_height);
> >+ZVAL_LONG(p_width,  ImageInfo.Thumbnail.width);
> >+ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
> > }
> > if (arg_c >= 4) {
> >-ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
> >+zval_dtor(p_imagetype);
> >+ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
> > }
> > 
> > #ifdef EXIF_DEBUG
> >@@ -4049,7 +4055,7 @@
> > exif_discard_imageinfo(&ImageInfo);
> > 
> > #ifdef EXIF_DEBUG
> >-php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done");
> >+php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done");
> > #endif
> > }
> > /* }}} */
> >
> >
> >
> >
> 
> 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c

2003-04-03 Thread Jani Taskinen

Shouldn't you MFB this?

--Jani


On Thu, 3 Apr 2003, Rasmus Lerdorf wrote:

>rasmus Thu Apr  3 10:57:31 2003 EDT
>
>  Modified files:  (Branch: PHP_4_3)
>/php4/ext/exif exif.c 
>  Log:
>  Clean up the parameter handling here
>  
>  
>Index: php4/ext/exif/exif.c
>diff -u php4/ext/exif/exif.c:1.118.2.15 php4/ext/exif/exif.c:1.118.2.16
>--- php4/ext/exif/exif.c:1.118.2.15Wed Apr  2 17:06:46 2003
>+++ php4/ext/exif/exif.c   Thu Apr  3 10:57:30 2003
>@@ -17,7 +17,7 @@
>+--+
>  */
> 
>-/* $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ */
>+/* $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ */
> 
> /*  ToDos
>  *
>@@ -95,7 +95,7 @@
> };
> /* }}} */
> 
>-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $"
>+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $"
> 
> /* {{{ PHP_MINFO_FUNCTION
>  */
>@@ -4001,19 +4001,22 @@
>Reads the embedded thumbnail */
> PHP_FUNCTION(exif_thumbnail)
> {
>-  zval **p_name, **p_width, **p_height, **p_imagetype;
>-  int ret, arg_c = ZEND_NUM_ARGS();
>+  zval *p_width, *p_height, *p_imagetype;
>+  char *p_name;
>+  int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
>   image_info_type ImageInfo;
> 
>   memset(&ImageInfo, 0, sizeof(ImageInfo));
> 
>-  if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, 
>&p_name, &p_width, &p_height, &p_imagetype) == FAILURE) {
>+  if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
>   WRONG_PARAM_COUNT;
>   }
> 
>-  convert_to_string_ex(p_name);
>+  if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, 
>&p_width, &p_height, &p_imagetype) == FAILURE) {
>+  return;
>+  }
> 
>-  ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
>+  ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
>   if (ret==FALSE) {
>   RETURN_FALSE;
>   }
>@@ -4035,11 +4038,14 @@
>   if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
>   exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
>   }
>-  ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
>-  ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
>+  zval_dtor(p_width);
>+  zval_dtor(p_height);
>+  ZVAL_LONG(p_width,  ImageInfo.Thumbnail.width);
>+  ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
>   }
>   if (arg_c >= 4) {
>-  ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
>+  zval_dtor(p_imagetype);
>+  ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
>   }
> 
> #ifdef EXIF_DEBUG
>@@ -4049,7 +4055,7 @@
>   exif_discard_imageinfo(&ImageInfo);
> 
> #ifdef EXIF_DEBUG
>-  php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done");
>+  php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done");
> #endif
> }
> /* }}} */
>
>
>
>

-- 
<- For Sale! ->


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) / TODO_SEGFAULTS

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:22:14 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4   TODO_SEGFAULTS 
  Log:
  Update - we purged the full list\!
  
Index: php4/TODO_SEGFAULTS
diff -u php4/TODO_SEGFAULTS:1.1.2.15 php4/TODO_SEGFAULTS:1.1.2.16
--- php4/TODO_SEGFAULTS:1.1.2.15Wed Apr  2 20:04:13 2003
+++ php4/TODO_SEGFAULTS Thu Apr  3 13:22:14 2003
@@ -15,28 +15,11 @@
 bcsub (Rasmus)
 mb_ereg, mb_ereg_match, mb_eregi, mb_split (Moriyoshi)
 xml_parser_create (Moriyoshi)
+ob_start (3) (Sascha)
 
 Open:
 
-ob_start (3) (Unable to reproduce - Moriyoshi)
-
-Notes:
-
-(3) calling ob_start in weird ways caused a segfault in 
-php_formatted_print(). In this line:
-   
-   format = Z_STRVAL_PP(args[0]);
-
-   format was zero.  The zval appeared to be fubar'ed.
-
-When one comments out the (unused) line
-
-$maxa = array_fill(100,1000,&$maxn);
-
-in the current test script, the segfault can be reproduced (it probably
-influences the heap layout, so that ob_start does not scribble over 
-important memory).
-
+none at this time
 
 Methodology
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4) /main output.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:20:40 2003 EDT

  Modified files:  (Branch: PHP_4)
/php4/main  output.c 
  Log:
  MFH
  
Index: php4/main/output.c
diff -u php4/main/output.c:1.142.2.3.2.1 php4/main/output.c:1.142.2.3.2.2
--- php4/main/output.c:1.142.2.3.2.1Tue Apr  1 14:15:15 2003
+++ php4/main/output.c  Thu Apr  3 13:20:40 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.142.2.3.2.1 2003/04/01 19:15:15 sas Exp $ */
+/* $Id: output.c,v 1.142.2.3.2.2 2003/04/03 18:20:40 sas Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -150,7 +150,7 @@
php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use 
output buffering in output buffering display handlers");
return FAILURE;
}
-   if (chunk_size) {
+   if (chunk_size > 0) {
if (chunk_size==1) {
chunk_size = 4096;
}
@@ -498,11 +498,7 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use 
ob_start(array($object,'method')) to specify instance $object and the name of a method 
of class %s to use as output handler", Z_OBJCE_P(output_handler)->name);
result = FAILURE;
} else {
-   if (output_handler) {
-   SEPARATE_ZVAL(&output_handler);
-   output_handler->refcount++;
-   }
-   result = php_ob_init_named(initial_size, block_size, 
OB_DEFAULT_HANDLER_NAME, output_handler, chunk_size, erase TSRMLS_CC);
+   result = php_ob_init_named(initial_size, block_size, 
OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC);
}
return result;
 }
@@ -723,6 +719,9 @@
RETURN_FALSE;
}
 
+   if (chunk_size < 0)
+   chunk_size = 0;
+   
if (php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC)==FAILURE) 
{
RETURN_FALSE;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /main output.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:19:52 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/main  output.c 
  Log:
  MFH
  
Index: php4/main/output.c
diff -u php4/main/output.c:1.142.2.8 php4/main/output.c:1.142.2.9
--- php4/main/output.c:1.142.2.8Wed Apr  2 19:51:14 2003
+++ php4/main/output.c  Thu Apr  3 13:19:52 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.142.2.8 2003/04/03 00:51:14 moriyoshi Exp $ */
+/* $Id: output.c,v 1.142.2.9 2003/04/03 18:19:52 sas Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -150,7 +150,7 @@
php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use 
output buffering in output buffering display handlers");
return FAILURE;
}
-   if (chunk_size) {
+   if (chunk_size > 0) {
if (chunk_size==1) {
chunk_size = 4096;
}
@@ -498,10 +498,7 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use 
ob_start(array($object,'method')) to specify instance $object and the name of a method 
of class %s to use as output handler", Z_OBJCE_P(output_handler)->name);
result = FAILURE;
} else {
-   if (output_handler) {
-   SEPARATE_ZVAL(&output_handler);
-   }
-   result = php_ob_init_named(initial_size, block_size, 
OB_DEFAULT_HANDLER_NAME, output_handler, chunk_size, erase TSRMLS_CC);
+   result = php_ob_init_named(initial_size, block_size, 
OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC);
}
return result;
 }
@@ -722,6 +719,9 @@
RETURN_FALSE;
}
 
+   if (chunk_size < 0)
+   chunk_size = 0;
+   
if (php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC)==FAILURE) 
{
RETURN_FALSE;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /main output.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:19:15 2003 EDT

  Modified files:  
/php4/main  output.c 
  Log:
  Add some checks and avoid passing invalid data to call_user_function_ex.
  
  Fixes some heap corruption and allocation of negative amounts of memory.
  
  
Index: php4/main/output.c
diff -u php4/main/output.c:1.152 php4/main/output.c:1.153
--- php4/main/output.c:1.152Wed Apr  2 19:50:17 2003
+++ php4/main/output.c  Thu Apr  3 13:19:15 2003
@@ -18,7 +18,7 @@
+--+
 */
 
-/* $Id: output.c,v 1.152 2003/04/03 00:50:17 moriyoshi Exp $ */
+/* $Id: output.c,v 1.153 2003/04/03 18:19:15 sas Exp $ */
 
 #include "php.h"
 #include "ext/standard/head.h"
@@ -150,7 +150,7 @@
php_error_docref("ref.outcontrol" TSRMLS_CC, E_ERROR, "Cannot use 
output buffering in output buffering display handlers");
return FAILURE;
}
-   if (chunk_size) {
+   if (chunk_size > 0) {
if (chunk_size==1) {
chunk_size = 4096;
}
@@ -498,10 +498,7 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, "No method name given: use 
ob_start(array($object,'method')) to specify instance $object and the name of a method 
of class %s to use as output handler", Z_OBJCE_P(output_handler)->name);
result = FAILURE;
} else {
-   if (output_handler) {
-   SEPARATE_ZVAL(&output_handler);
-   }
-   result = php_ob_init_named(initial_size, block_size, 
OB_DEFAULT_HANDLER_NAME, output_handler, chunk_size, erase TSRMLS_CC);
+   result = php_ob_init_named(initial_size, block_size, 
OB_DEFAULT_HANDLER_NAME, NULL, chunk_size, erase TSRMLS_CC);
}
return result;
 }
@@ -719,6 +716,9 @@
RETURN_FALSE;
}
 
+   if (chunk_size < 0)
+   chunk_size = 0;
+   
if (php_start_ob_buffer(output_handler, chunk_size, erase TSRMLS_CC)==FAILURE) 
{
RETURN_FALSE;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4) /ext/standard basic_functions.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:11:04 2003 EDT

  Modified files:  (Branch: PHP_4)
/php4/ext/standard  basic_functions.c 
  Log:
  MFH
  
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.543.2.5.2.1 
php4/ext/standard/basic_functions.c:1.543.2.5.2.2
--- php4/ext/standard/basic_functions.c:1.543.2.5.2.1   Tue Apr  1 05:02:52 2003
+++ php4/ext/standard/basic_functions.c Thu Apr  3 13:11:03 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.543.2.5.2.1 2003/04/01 10:02:52 sas Exp $ */
+/* $Id: basic_functions.c,v 1.543.2.5.2.2 2003/04/03 18:11:03 sas Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2117,7 +2117,12 @@
if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, 
shutdown_function_entry.arguments) == FAILURE) {
RETURN_FALSE;
}
-   convert_to_string(shutdown_function_entry.arguments[0]);
+   
+   /* Prevent entering of anything but arrays/strings */
+   if (Z_TYPE_P(shutdown_function_entry.arguments[0]) != IS_ARRAY) {
+   convert_to_string(shutdown_function_entry.arguments[0]);
+   }
+   
if (!BG(user_shutdown_function_names)) {
ALLOC_HASHTABLE(BG(user_shutdown_function_names));
zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void 
(*)(void *)) user_shutdown_function_dtor, 0);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /ext/standard basic_functions.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:10:41 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/standard  basic_functions.c 
  Log:
  MFH
  
  
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.543.2.11 
php4/ext/standard/basic_functions.c:1.543.2.12
--- php4/ext/standard/basic_functions.c:1.543.2.11  Wed Apr  2 18:09:39 2003
+++ php4/ext/standard/basic_functions.c Thu Apr  3 13:10:41 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.543.2.11 2003/04/02 23:09:39 rasmus Exp $ */
+/* $Id: basic_functions.c,v 1.543.2.12 2003/04/03 18:10:41 sas Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2112,7 +2112,12 @@
if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, 
shutdown_function_entry.arguments) == FAILURE) {
RETURN_FALSE;
}
-   convert_to_string(shutdown_function_entry.arguments[0]);
+   
+   /* Prevent entering of anything but arrays/strings */
+   if (Z_TYPE_P(shutdown_function_entry.arguments[0]) != IS_ARRAY) {
+   convert_to_string(shutdown_function_entry.arguments[0]);
+   }
+   
if (!BG(user_shutdown_function_names)) {
ALLOC_HASHTABLE(BG(user_shutdown_function_names));
zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void 
(*)(void *)) user_shutdown_function_dtor, 0);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/standard basic_functions.c

2003-04-03 Thread Sascha Schumann
sas Thu Apr  3 13:09:41 2003 EDT

  Modified files:  
/php4/ext/standard  basic_functions.c 
  Log:
  Prevent entering of anything but arrays/strings in register_shutdown_func
  
  Noticed by: Jan Schneider
  
  
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.603 
php4/ext/standard/basic_functions.c:1.604
--- php4/ext/standard/basic_functions.c:1.603   Wed Apr  2 20:12:47 2003
+++ php4/ext/standard/basic_functions.c Thu Apr  3 13:09:41 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.603 2003/04/03 01:12:47 sniper Exp $ */
+/* $Id: basic_functions.c,v 1.604 2003/04/03 18:09:41 sas Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -2173,7 +2173,12 @@
if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, 
shutdown_function_entry.arguments) == FAILURE) {
RETURN_FALSE;
}
-   convert_to_string(shutdown_function_entry.arguments[0]);
+   
+   /* Prevent entering of anything but arrays/strings */
+   if (Z_TYPE_P(shutdown_function_entry.arguments[0]) != IS_ARRAY) {
+   convert_to_string(shutdown_function_entry.arguments[0]);
+   }
+   
if (!BG(user_shutdown_function_names)) {
ALLOC_HASHTABLE(BG(user_shutdown_function_names));
zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void 
(*)(void *)) user_shutdown_function_dtor, 0);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4(PHP_4_3) /ext/exif exif.c

2003-04-03 Thread Rasmus Lerdorf
rasmus  Thu Apr  3 10:57:31 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php4/ext/exif  exif.c 
  Log:
  Clean up the parameter handling here
  
  
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.118.2.15 php4/ext/exif/exif.c:1.118.2.16
--- php4/ext/exif/exif.c:1.118.2.15 Wed Apr  2 17:06:46 2003
+++ php4/ext/exif/exif.cThu Apr  3 10:57:30 2003
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $ */
+/* $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $ */
 
 /*  ToDos
  *
@@ -95,7 +95,7 @@
 };
 /* }}} */
 
-#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.15 2003/04/02 22:06:46 rasmus Exp $"
+#define EXIF_VERSION "1.4 $Id: exif.c,v 1.118.2.16 2003/04/03 15:57:30 rasmus Exp $"
 
 /* {{{ PHP_MINFO_FUNCTION
  */
@@ -4001,19 +4001,22 @@
Reads the embedded thumbnail */
 PHP_FUNCTION(exif_thumbnail)
 {
-   zval **p_name, **p_width, **p_height, **p_imagetype;
-   int ret, arg_c = ZEND_NUM_ARGS();
+   zval *p_width, *p_height, *p_imagetype;
+   char *p_name;
+   int p_name_len, ret, arg_c = ZEND_NUM_ARGS();
image_info_type ImageInfo;
 
memset(&ImageInfo, 0, sizeof(ImageInfo));
 
-   if ((arg_c!=1 && arg_c!=3 && arg_c!=4) || zend_get_parameters_ex(arg_c, 
&p_name, &p_width, &p_height, &p_imagetype) == FAILURE) {
+   if (arg_c!=1 && arg_c!=3 && arg_c!=4) {
WRONG_PARAM_COUNT;
}
 
-   convert_to_string_ex(p_name);
+   if (zend_parse_parameters(arg_c TSRMLS_CC, "s|z/z/z/", &p_name, &p_name_len, 
&p_width, &p_height, &p_imagetype) == FAILURE) {
+   return;
+   }
 
-   ret = exif_read_file(&ImageInfo, Z_STRVAL_PP(p_name), 1, 0 TSRMLS_CC);
+   ret = exif_read_file(&ImageInfo, p_name, 1, 0 TSRMLS_CC);
if (ret==FALSE) {
RETURN_FALSE;
}
@@ -4035,11 +4038,14 @@
if (!ImageInfo.Thumbnail.width || !ImageInfo.Thumbnail.height) {
exif_scan_thumbnail(&ImageInfo TSRMLS_CC);
}
-   ZVAL_LONG(*p_width,  ImageInfo.Thumbnail.width);
-   ZVAL_LONG(*p_height, ImageInfo.Thumbnail.height);
+   zval_dtor(p_width);
+   zval_dtor(p_height);
+   ZVAL_LONG(p_width,  ImageInfo.Thumbnail.width);
+   ZVAL_LONG(p_height, ImageInfo.Thumbnail.height);
}
if (arg_c >= 4) {
-   ZVAL_LONG(*p_imagetype, ImageInfo.Thumbnail.filetype);
+   zval_dtor(p_imagetype);
+   ZVAL_LONG(p_imagetype, ImageInfo.Thumbnail.filetype);
}
 
 #ifdef EXIF_DEBUG
@@ -4049,7 +4055,7 @@
exif_discard_imageinfo(&ImageInfo);
 
 #ifdef EXIF_DEBUG
-   php_error_docref1(NULL TSRMLS_CC, Z_STRVAL_PP(p_name), E_NOTICE, "done");
+   php_error_docref1(NULL TSRMLS_CC, p_name, E_NOTICE, "done");
 #endif
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 / NEWS

2003-04-03 Thread Jani Taskinen

Please take a few minutes and read all the entries in this file.
(the ones for PHP 5)

I've been trying to keep the different 'types' of entries grouped
so please, try putting your entries in correct places.

 
--Jani



On Thu, 3 Apr 2003, Christian Stocker wrote:

>chregu Thu Apr  3 05:24:53 2003 EDT
>
>  Modified files:  
>/php4  NEWS 
>  Log:
>  new domxml_elem_set_attribute_node() should have gone into NEWS, but I forgot..
>  
>  
>Index: php4/NEWS
>diff -u php4/NEWS:1.1388 php4/NEWS:1.1389
>--- php4/NEWS:1.1388   Wed Apr  2 20:30:52 2003
>+++ php4/NEWS  Thu Apr  3 05:24:53 2003
>@@ -1,6 +1,7 @@
> PHPNEWS
> |||
> ? ? ??? 200?, Version 5.0.0
>+- Added domxml_elem_set_attribute_node() method (bug #17638). (Rob Richards)
> - Fixed bug #23009 (pg_select with timestamp). (Marcus, Jay)
> - Moved extensions to PECL (http://pear.php.net/): (James, Tal)
>   . ext/fribidi
>
>
>
>

-- 
<- For Sale! ->


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 / NEWS

2003-04-03 Thread Jani Taskinen
sniper  Thu Apr  3 06:04:16 2003 EDT

  Modified files:  
/php4   NEWS 
  Log:
  reorder
  
Index: php4/NEWS
diff -u php4/NEWS:1.1389 php4/NEWS:1.1390
--- php4/NEWS:1.1389Thu Apr  3 05:24:53 2003
+++ php4/NEWS   Thu Apr  3 06:04:16 2003
@@ -1,7 +1,6 @@
 PHPNEWS
 |||
 ? ? ??? 200?, Version 5.0.0
-- Added domxml_elem_set_attribute_node() method (bug #17638). (Rob Richards)
 - Fixed bug #23009 (pg_select with timestamp). (Marcus, Jay)
 - Moved extensions to PECL (http://pear.php.net/): (James, Tal)
   . ext/fribidi
@@ -22,6 +21,7 @@
 - Changed array_search() to accept also objects as a needle. (Moriyoshi)
 - Changed ext/mcrypt to require libmcrypt version 2.5.6 or greater. (Derick)
 - Changed uniqid() parameters to be optional and allow any prefix length. (Marcus)
+- Added domxml_elem_set_attribute_node() method (bug #17638). (Rob Richards)
 - Added optional parameter to get_browser() to make it return an array. (Jay)
 - Added optional parameter to openssl_sign() to specify the hashing algorithm.
   ([EMAIL PROTECTED], Derick)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-03 Thread Jani Taskinen
On Wed, 2 Apr 2003, Rasmus Lerdorf wrote:

>Oh, give me a break Jani.  A space here or there makes absolutely no
>difference to the readability of the code, but all these whitespace
>commits get in the way of any real work when trying to track down problems
>via cvs diffs.

If you had committed correct style code in the first place,
I wouldn't have to make the 2nd commit on it. Hence the note
about not committing code like that anymore.

--Jani


>On Thu, 3 Apr 2003, Jani Taskinen wrote:
>
>> sniper   Wed Apr  2 20:16:34 2003 EDT
>>
>>   Modified files:
>> /php4/ext/bcmath bcmath.c
>>   Log:
>>   Another CS fix.
>>   # Rasmus, at least try keep the style consistent..
>>
>>
>> Index: php4/ext/bcmath/bcmath.c
>> diff -u php4/ext/bcmath/bcmath.c:1.53 php4/ext/bcmath/bcmath.c:1.54
>> --- php4/ext/bcmath/bcmath.c:1.53Wed Apr  2 18:51:52 2003
>> +++ php4/ext/bcmath/bcmath.c Wed Apr  2 20:16:34 2003
>> @@ -16,7 +16,7 @@
>> +--+
>>  */
>>
>> -/* $Id: bcmath.c,v 1.53 2003/04/02 23:51:52 rasmus Exp $ */
>> +/* $Id: bcmath.c,v 1.54 2003/04/03 01:16:34 sniper Exp $ */
>>
>>  #ifdef HAVE_CONFIG_H
>>  #include "config.h"
>> @@ -97,7 +97,11 @@
>>  if (cfg_get_long("bcmath.scale", &bc_precision) == FAILURE) {
>>  bc_precision = 0;
>>  }
>> -if(bc_precision<0) bc_precision=0;
>> +
>> +if (bc_precision < 0) {
>> +bc_precision = 0;
>> +}
>> +
>>  bc_init_numbers(TSRMLS_C);
>>
>>  return SUCCESS;
>> @@ -145,7 +149,7 @@
>>  WRONG_PARAM_COUNT;
>>  }
>>  convert_to_long_ex(scale_param);
>> -scale = (int) (Z_LVAL_PP(scale_param)<0) ? 
>> 0:Z_LVAL_PP(scale_param);
>> +scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : 
>> Z_LVAL_PP(scale_param);
>>  break;
>>  default:
>>  WRONG_PARAM_COUNT;
>> @@ -191,7 +195,7 @@
>>  WRONG_PARAM_COUNT;
>>  }
>>  convert_to_long_ex(scale_param);
>> -scale = (int) (Z_LVAL_PP(scale_param)<0) ? 
>> 0:Z_LVAL_PP(scale_param);
>> +scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : 
>> Z_LVAL_PP(scale_param);
>>  break;
>>  default:
>>  WRONG_PARAM_COUNT;
>> @@ -237,7 +241,7 @@
>>  WRONG_PARAM_COUNT;
>>  }
>>  convert_to_long_ex(scale_param);
>> -scale = (int) (Z_LVAL_PP(scale_param)<0) ? 
>> 0:Z_LVAL_PP(scale_param);
>> +scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : 
>> Z_LVAL_PP(scale_param);
>>  break;
>>  default:
>>  WRONG_PARAM_COUNT;
>> @@ -283,7 +287,7 @@
>>  WRONG_PARAM_COUNT;
>>  }
>>  convert_to_long_ex(scale_param);
>> -scale = (int) (Z_LVAL_PP(scale_param)<0) ? 
>> 0:Z_LVAL_PP(scale_param);
>> +scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : 
>> Z_LVAL_PP(scale_param);
>>  break;
>>  default:
>>  WRONG_PARAM_COUNT;
>> @@ -296,7 +300,7 @@
>>  bc_init_num(&result TSRMLS_CC);
>>  php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
>>  php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
>> -switch (bc_divide (first, second, &result, scale TSRMLS_CC)) {
>> +switch (bc_divide(first, second, &result, scale TSRMLS_CC)) {
>>  case 0: /* OK */
>>  if (result->n_scale > scale) {
>>  result->n_scale = scale;
>> @@ -411,7 +415,7 @@
>>  WRONG_PARAM_COUNT;
>>  }
>>  convert_to_long_ex(scale_param);
>> -scale = (int) (Z_LVAL_PP(scale_param)<0) ? 
>> 0:Z_LVAL_PP(scale_param);
>> +scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : 
>> Z_LVAL_PP(scale_param);
>>  break;
>>  default:
>>  WRONG_PARAM_COUNT;
>> @@ -457,7 +461,7 @@
>>  WRONG_PARAM_COUNT;
>>  }
>>  convert_to_long_ex(scale_param);
>> -scale = (int) (Z_LVAL_PP(scale_param)<0) ? 
>> 0:Z_LVAL_PP(scale_param);
>> +scale = (int) (Z_LVAL_PP(scale_param) < 0) ? 0 : 
>> Z_LVAL_PP(scale_param);
>> 

[PHP-CVS] cvs: php4 / NEWS

2003-04-03 Thread Christian Stocker
chregu  Thu Apr  3 05:24:53 2003 EDT

  Modified files:  
/php4   NEWS 
  Log:
  new domxml_elem_set_attribute_node() should have gone into NEWS, but I forgot..
  
  
Index: php4/NEWS
diff -u php4/NEWS:1.1388 php4/NEWS:1.1389
--- php4/NEWS:1.1388Wed Apr  2 20:30:52 2003
+++ php4/NEWS   Thu Apr  3 05:24:53 2003
@@ -1,6 +1,7 @@
 PHPNEWS
 |||
 ? ? ??? 200?, Version 5.0.0
+- Added domxml_elem_set_attribute_node() method (bug #17638). (Rob Richards)
 - Fixed bug #23009 (pg_select with timestamp). (Marcus, Jay)
 - Moved extensions to PECL (http://pear.php.net/): (James, Tal)
   . ext/fribidi



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/domxml php_domxml.c php_domxml.h

2003-04-03 Thread Christian Stocker
chregu  Thu Apr  3 05:21:19 2003 EDT

  Modified files:  
/php4/ext/domxmlphp_domxml.c php_domxml.h 
  Log:
  - Added domxml_elem_set_attribute_node() method. (Rob Richards)
  
  
Index: php4/ext/domxml/php_domxml.c
diff -u php4/ext/domxml/php_domxml.c:1.242 php4/ext/domxml/php_domxml.c:1.243
--- php4/ext/domxml/php_domxml.c:1.242  Wed Apr  2 05:31:33 2003
+++ php4/ext/domxml/php_domxml.cThu Apr  3 05:21:19 2003
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_domxml.c,v 1.242 2003/04/02 10:31:33 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.243 2003/04/03 10:21:19 chregu Exp $ */
 
 /* TODO
  * - Support Notation Nodes
@@ -429,9 +429,7 @@
PHP_FALIAS(set_attribute,   domxml_elem_set_attribute, 
 NULL)
PHP_FALIAS(remove_attribute,domxml_elem_remove_attribute,   NULL)
PHP_FALIAS(get_attribute_node,  domxml_elem_get_attribute_node, NULL)
-/* since this function is not implemented, outcomment it for the time beeing
PHP_FALIAS(set_attribute_node,  domxml_elem_set_attribute_node, NULL)
-*/
 #if defined(LIBXML_XPATH_ENABLED)  
PHP_FALIAS(get_elements_by_tagname, domxml_elem_get_elements_by_tagname,   
 NULL)
 #endif
@@ -2849,32 +2847,72 @@
 
 /* {{{ proto bool domxml_elem_set_attribute_node(object attr)
Sets value of given attribute */
-/* since this function is not implemented, outcomment it for the time beeing
 PHP_FUNCTION(domxml_elem_set_attribute_node)
 {
-   zval *id, **arg1, *rv = NULL;
+   zval *id, *node, *rv = NULL;
xmlNode *nodep;
-   xmlAttr *attrp, *newattrp;
+   xmlAttr *attrp, *newattrp, *existattrp;
int ret;
 
-   if ((ZEND_NUM_ARGS() == 1) && (zend_get_parameters_ex(1, &arg1) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   DOMXML_GET_THIS_OBJ(nodep, id, le_domxmlnodep);
+
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &node) == FAILURE) {
+   return;
}
 
-   id = getThis();
-   nodep = php_dom_get_object(id, le_domxmlelementp, 0 TSRMLS_CC);
-   attrp = php_dom_get_object(*arg1, le_domxmlattrp, 0 TSRMLS_CC);
+   DOMXML_GET_OBJ(attrp, node, le_domxmlnodep);
 
-   FIXME: The following line doesn't work 
-   newattrp = xmlCopyProp(nodep, attrp);
-   if (!newattrp) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute '%s'", 
attrp->name);
+   if (attrp->type != XML_ATTRIBUTE_NODE) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attribute node is 
required");
RETURN_FALSE;
}
 
+
+   existattrp = xmlHasProp(nodep,attrp->name);
+   if (existattrp != NULL) {
+   /* We cannot unlink an existing attribute as it may never be freed
+   Only the content of the text node of an attribute node is transfered 
over */
+
+   xmlChar *mem;
+   xmlNode *first, *firstattrp;
+
+   first = existattrp->children;
+   firstattrp = attrp->children;
+   if (mem = xmlNodeGetContent(firstattrp)) {
+   if (!first) {
+   xmlNodeSetContent((xmlNode *) existattrp, mem);
+   } else {
+   xmlNodeSetContent(first, mem);
+   }
+   xmlFree(mem);
+   newattrp = existattrp;
+   } else {
+   RETURN_FALSE;
+   }
+   } else {
+   /* xmlCopyProp does not add the copy to the element node.
+   It does set the parent of the copy to the element node however 
*/
+   newattrp = xmlCopyProp(nodep, attrp);
+   if (!newattrp) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, "No such attribute 
'%s'", attrp->name);
+   RETURN_FALSE;
+   } else {
+   xmlAttr *prop;
+   prop = nodep->properties;
+   if (prop == NULL) {
+   nodep->properties = newattrp;
+   } else {
+   while (prop->next != NULL) {
+   prop = prop->next;
+   }
+   prop->next = newattrp;
+   newattrp->prev = prop;
+   }
+   }
+   }
+
DOMXML_RET_OBJ(rv, (xmlNodePtr) newattrp, &ret);
 }
-*/
 /* }}} */
 
 /* {{{ proto string domxml_elem_has_attribute(string attrname)
Index: php4/ext/domxml/php_domxml.h
diff -u php4/ext/domxml/php_domxml.h:1.75 php4/ext/domxml/php_domxml.h:1.76
--- php4/ext/domxml/php_domxml.h:1.75   Mon Jan  6 04:59:53 2003
+++ php4/ext/domxml/php_domxml.hThu Apr  3 05:21:19 

Re: [PHP-CVS] cvs: php4 /ext/bcmath bcmath.c

2003-04-03 Thread Rasmus Lerdorf
> Regardless, I think the ideal answer is for everyone to just follow
> the same standard from the beginning.  If we all did that, there would
> be no reason for style- or whitespace-related commits.

Yes, but that is simply never going to happen as even a brief look at the
current code will attest to.  I'd just like to keep the extranenous WS/CS
commits to a minimum and only for the most serious cases.  ie. don't
change "a=1" to "a = 1" in someone's code when we have thousands of those
already in the code and it really is not a serious CS violation at all.

-Rasmus

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/mysqli mysqli_api.c

2003-04-03 Thread Georg Richter
georg   Thu Apr  3 03:03:59 2003 EDT

  Modified files:  
/php4/ext/mysqlimysqli_api.c 
  Log:
  fixed mysqli_prepare_result
  
  
Index: php4/ext/mysqli/mysqli_api.c
diff -u php4/ext/mysqli/mysqli_api.c:1.21 php4/ext/mysqli/mysqli_api.c:1.22
--- php4/ext/mysqli/mysqli_api.c:1.21   Mon Mar 17 07:48:38 2003
+++ php4/ext/mysqli/mysqli_api.cThu Apr  3 03:03:59 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter <[EMAIL PROTECTED]>|
   +--+
 
-  $Id: mysqli_api.c,v 1.21 2003/03/17 12:48:38 hholzgra Exp $ 
+  $Id: mysqli_api.c,v 1.22 2003/04/03 08:03:59 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -1342,10 +1342,11 @@
  */
 PHP_FUNCTION(mysqli_prepare_result)
 {
-   STMT*stmt;
-   MYSQL_RES   *result;
-   zval*mysql_stmt;
-   PR_STMT *prstmt;
+   STMT*stmt;
+   MYSQL_RES   *result;
+   zval*mysql_stmt;
+   PR_STMT *prstmt = NULL;
+   MYSQLI_RESOURCE *mysqli_resource;
 
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", 
&mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -1356,7 +1357,10 @@
RETURN_FALSE;
}
 
-   MYSQLI_RETURN_RESOURCE(result, mysqli_result_class_entry);  
+   mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
+   mysqli_resource->ptr = (void *)result;
+   mysqli_resource->prinfo = (void *)prstmt;
+   MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry); 
 }
 /* }}} */
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/mysqli/tests 047.phpt

2003-04-03 Thread Georg Richter
georg   Thu Apr  3 03:03:12 2003 EDT

  Modified files:  
/php4/ext/mysqli/tests  047.phpt 
  Log:
  fixed output
  
  
Index: php4/ext/mysqli/tests/047.phpt
diff -u php4/ext/mysqli/tests/047.phpt:1.2 php4/ext/mysqli/tests/047.phpt:1.3
--- php4/ext/mysqli/tests/047.phpt:1.2  Sun Feb 16 16:19:32 2003
+++ php4/ext/mysqli/tests/047.phpt  Thu Apr  3 03:03:12 2003
@@ -26,10 +26,10 @@
mysqli_stmt_close($stmt);   
mysqli_close($link);
 ?>
---EXPECT--
+--EXPECTF--
 array(2) {
   [0]=>
-  object(stdClass)(9) {
+  object(stdClass)#%d (9) {
 ["name"]=>
 string(3) "foo"
 ["orgname"]=>
@@ -50,7 +50,7 @@
 int(0)
   }
   [1]=>
-  object(stdClass)(9) {
+  object(stdClass)#%d (9) {
 ["name"]=>
 string(3) "bar"
 ["orgname"]=>



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php