helly Wed Mar 9 19:10:21 2005 EDT Modified files: /php-src/ext/standard var_unserializer.re Log: - Fix #31442 unserialize broken on 64-bit systems - Fix one warning http://cvs.php.net/diff.php/php-src/ext/standard/var_unserializer.re?r1=1.48&r2=1.49&ty=u Index: php-src/ext/standard/var_unserializer.re diff -u php-src/ext/standard/var_unserializer.re:1.48 php-src/ext/standard/var_unserializer.re:1.49 --- php-src/ext/standard/var_unserializer.re:1.48 Mon Mar 7 17:24:00 2005 +++ php-src/ext/standard/var_unserializer.re Wed Mar 9 19:10:21 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: var_unserializer.re,v 1.48 2005/03/07 22:24:00 helly Exp $ */ +/* $Id: var_unserializer.re,v 1.49 2005/03/10 00:10:21 helly Exp $ */ #include "php.h" #include "ext/standard/php_var.h" @@ -27,7 +27,7 @@ typedef struct { zval *data[VAR_ENTRIES_MAX]; - int used_slots; + long used_slots; void *next; } var_entries; @@ -80,7 +80,7 @@ PHPAPI void var_replace(php_unserialize_data_t *var_hashx, zval *ozval, zval **nzval) { - int i; + long i; var_entries *var_hash = var_hashx->first; while (var_hash) { @@ -94,7 +94,7 @@ } } -static int var_access(php_unserialize_data_t *var_hashx, int id, zval ***store) +static int var_access(php_unserialize_data_t *var_hashx, long id, zval ***store) { var_entries *var_hash = var_hashx->first; @@ -115,7 +115,7 @@ PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) { void *next; - int i; + long i; var_entries *var_hash = var_hashx->first; while (var_hash) { @@ -156,10 +156,10 @@ -static inline int parse_iv2(const unsigned char *p, const unsigned char **q) +static inline long parse_iv2(const unsigned char *p, const unsigned char **q) { char cursor; - int result = 0; + long result = 0; int neg = 0; switch (*p) { @@ -184,7 +184,7 @@ return result; } -static inline int parse_iv(const unsigned char *p) +static inline long parse_iv(const unsigned char *p) { return parse_iv2(p, NULL); } @@ -214,7 +214,7 @@ #define UNSERIALIZE_PARAMETER zval **rval, const unsigned char **p, const unsigned char *max, php_unserialize_data_t *var_hash TSRMLS_DC #define UNSERIALIZE_PASSTHRU rval, p, max, var_hash TSRMLS_CC -static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, int elements) +static inline int process_nested_data(UNSERIALIZE_PARAMETER, HashTable *ht, long elements) { while (elements-- > 0) { zval *key, *data, **old_data; @@ -283,7 +283,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - int datalen; + long datalen; if(ce->unserialize == NULL) { zend_error(E_WARNING, "Class %s has no unserializer", ce->name); @@ -295,7 +295,7 @@ (*p) += 2; if(datalen < 0 || (*p) + datalen >= max) { - zend_error(E_WARNING, "Insufficient data for unserializing - %d required, %d present", datalen, max - (*p)); + zend_error(E_WARNING, "Insufficient data for unserializing - %ld required, %d present", datalen, max - (*p)); return 0; } @@ -308,10 +308,10 @@ return finish_nested_data(UNSERIALIZE_PASSTHRU); } -static inline int object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) +static inline long object_common1(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { - int elements; - + long elements; + elements = parse_iv2((*p) + 2, p); (*p) += 2; @@ -320,7 +320,7 @@ return elements; } -static inline int object_common2(UNSERIALIZE_PARAMETER, int elements) +static inline int object_common2(UNSERIALIZE_PARAMETER, long elements) { zval *retval_ptr = NULL; zval fname; @@ -360,7 +360,7 @@ /*!re2c "R:" iv ";" { - int id; + long id; *p = YYCURSOR; if (!var_hash) return 0; @@ -381,7 +381,7 @@ } "r:" iv ";" { - int id; + long id; *p = YYCURSOR; if (!var_hash) return 0; @@ -442,7 +442,7 @@ "d:" (iv | nv | nvexp) ";" { *p = YYCURSOR; INIT_PZVAL(*rval); - ZVAL_DOUBLE(*rval, zend_strtod(start + 2, NULL)); + ZVAL_DOUBLE(*rval, zend_strtod((const char *)start + 2, NULL)); return 1; } @@ -475,8 +475,8 @@ } "a:" uiv ":" "{" { - int elements = parse_iv(start + 2); - + long elements = parse_iv(start + 2); + /* use iv() not uiv() in order to check data range */ *p = YYCURSOR; if (elements < 0) { @@ -506,7 +506,7 @@ object ":" uiv ":" ["] { size_t len, len2, len3, maxlen; - int elements; + long elements; char *class_name; zend_class_entry *ce; zend_class_entry **pce;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php