helly Wed Mar 9 18:58:45 2005 EDT
Modified files:
/php-src/ext/standard var_unserializer.c
Log:
- Fix #31442 unserialize broken on 64-bit systems
- Fix one warning
http://cvs.php.net/diff.php/php-src/ext/standard/var_unserializer.c?r1=1.60&r2=1.61&ty=u
Index: php-src/ext/standard/var_unserializer.c
diff -u php-src/ext/standard/var_unserializer.c:1.60
php-src/ext/standard/var_unserializer.c:1.61
--- php-src/ext/standard/var_unserializer.c:1.60 Tue Mar 8 01:40:05 2005
+++ php-src/ext/standard/var_unserializer.c Wed Mar 9 18:58:44 2005
@@ -1,5 +1,5 @@
-/* Generated by re2c 0.9.4 on Tue Mar 8 08:39:34 2005 */
-#line 1 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+/* Generated by re2c 0.9.4 on Thu Mar 10 00:54:25 2005 */
+#line 1 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: var_unserializer.c,v 1.60 2005/03/08 06:40:05 sniper Exp $ */
+/* $Id: var_unserializer.c,v 1.61 2005/03/09 23:58:44 helly Exp $ */
#include "php.h"
#include "ext/standard/php_var.h"
@@ -29,7 +29,7 @@
typedef struct {
zval *data[VAR_ENTRIES_MAX];
- int used_slots;
+ long used_slots;
void *next;
} var_entries;
@@ -82,7 +82,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) {
@@ -96,7 +96,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;
@@ -117,7 +117,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) {
@@ -147,15 +147,15 @@
#define YYMARKER marker
-#line 155 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 155 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
-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) {
@@ -180,7 +180,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);
}
@@ -210,7 +210,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;
@@ -279,7 +279,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);
@@ -291,7 +291,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;
}
@@ -304,10 +304,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;
@@ -316,7 +316,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;
@@ -448,7 +448,7 @@
if(yych == ':') goto yy87;
goto yy4;
yy4:
-#line 625 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 625 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{ return 0; }
#line 103 "<stdout>"
yy5: yyaccept = 0;
@@ -489,7 +489,7 @@
yy14: ++YYCURSOR;
goto yy15;
yy15:
-#line 619 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 619 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
/* this is the case where we have less data than planned */
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Unexpected end of
serialized data");
@@ -518,10 +518,10 @@
yy22: ++YYCURSOR;
goto yy23;
yy23:
-#line 507 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 507 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
size_t len, len2, len3, maxlen;
- int elements;
+ long elements;
char *class_name;
zend_class_entry *ce;
zend_class_entry **pce;
@@ -659,7 +659,7 @@
yy29: ++YYCURSOR;
goto yy30;
yy30:
-#line 499 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 499 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
INIT_PZVAL(*rval);
@@ -691,10 +691,10 @@
yy36: ++YYCURSOR;
goto yy37;
yy37:
-#line 477 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 477 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
- 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) {
@@ -737,7 +737,7 @@
yy43: ++YYCURSOR;
goto yy44;
yy44:
-#line 449 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 449 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
size_t len, maxlen;
char *str;
@@ -854,11 +854,11 @@
yy55: ++YYCURSOR;
goto yy56;
yy56:
-#line 442 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 442 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
*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;
}
#line 520 "<stdout>"
@@ -921,7 +921,7 @@
yy66: ++YYCURSOR;
goto yy67;
yy67:
-#line 427 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 427 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
@@ -965,7 +965,7 @@
yy73: ++YYCURSOR;
goto yy74;
yy74:
-#line 420 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 420 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
@@ -983,7 +983,7 @@
yy77: ++YYCURSOR;
goto yy78;
yy78:
-#line 413 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 413 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
@@ -994,7 +994,7 @@
yy79: ++YYCURSOR;
goto yy80;
yy80:
-#line 406 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 406 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
*p = YYCURSOR;
INIT_PZVAL(*rval);
@@ -1027,9 +1027,9 @@
yy85: ++YYCURSOR;
goto yy86;
yy86:
-#line 383 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 383 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
- int id;
+ long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -1076,9 +1076,9 @@
yy91: ++YYCURSOR;
goto yy92;
yy92:
-#line 362 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 362 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
{
- int id;
+ long id;
*p = YYCURSOR;
if (!var_hash) return 0;
@@ -1099,7 +1099,7 @@
}
#line 761 "<stdout>"
}
-#line 627 "/usr/src/php/php5/ext/standard/var_unserializer.re"
+#line 627 "/usr/src/php-cvs/ext/standard/var_unserializer.re"
return 0;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php