cvs: php-src(PHP_5_1) / NEWS /ext/standard pack.c /ext/standard/tests/strings bug35817.phpt
| From: | Ilia Alshanetsky | Date: | Wed, 28 Dec 2005 20:55:14 +0000 |
| Subject: | cvs: php-src(PHP_5_1) / NEWS /ext/standard pack.c /ext/standard/tests/strings bug35817.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36279@lists.php.net to get a copy of this message | ||
iliaa Wed Dec 28 20:55:14 2005 EDT
Added files: (Branch: PHP_5_1)
/php-src/ext/standard/tests/strings bug35817.phpt
Modified files:
/php-src NEWS
/php-src/ext/standard pack.c
Log:
Fixed bug #35817 (unpack() does not decode odd number of hexadecimal values)
http://cvs.php.net/viewcvs.cgi/php-src/NEWS?r1=1.2027.2.329&r2=1.2027.2.330&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.329 php-src/NEWS:1.2027.2.330
--- php-src/NEWS:1.2027.2.329 Tue Dec 27 22:32:01 2005
+++ php-src/NEWS Wed Dec 28 20:55:13 2005
@@ -9,6 +9,8 @@
(Andrey)
- Fixed bug #35821 (array_map() segfaults when exception is throwed from
the callback). (Tony)
+- Fixed bug #35817 (unpack() does not decode odd number of hexadecimal values).
+ (Ilia)
- Fixed bug #35781 (stream_filter_append() can cause segfault). (Tony)
- Fixed bug #35759 (mysqli_stmt_bind_result() makes huge allocation when
column empty). (Andrey)
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/pack.c?r1=1.57.2.1&r2=1.57.2.2&diff_format=u
Index: php-src/ext/standard/pack.c
diff -u php-src/ext/standard/pack.c:1.57.2.1 php-src/ext/standard/pack.c:1.57.2.2
--- php-src/ext/standard/pack.c:1.57.2.1 Thu Dec 15 22:15:01 2005
+++ php-src/ext/standard/pack.c Wed Dec 28 20:55:14 2005
@@ -15,7 +15,7 @@
| Author: Chris Schneider <cschneid@relog.ch> |
+----------------------------------------------------------------------+
*/
-/* $Id: pack.c,v 1.57.2.1 2005/12/15 22:15:01 tony2001 Exp $ */
+/* $Id: pack.c,v 1.57.2.2 2005/12/28 20:55:14 iliaa Exp $ */
#include "php.h"
@@ -245,7 +245,7 @@
switch ((int) code) {
case 'h':
case 'H':
- INC_OUTPUTPOS((arg + 1) / 2,1) /* 4 bit per arg */
+ INC_OUTPUTPOS((arg + (arg % 2)) / 2,1) /* 4 bit per arg */
break;
case 'a':
@@ -538,7 +538,7 @@
while (formatlen-- > 0) {
char type = *(format++);
char c;
- int arg = 1;
+ int arg = 1, argb;
char *name;
int namelen;
int size=0;
@@ -563,6 +563,7 @@
/* Get of new value in array */
name = format;
+ argb = arg;
while (formatlen > 0 && *format != '/') {
formatlen--;
@@ -592,7 +593,7 @@
case 'h':
case 'H':
- size = (arg > 0) ? arg / 2 : arg;
+ size = (arg > 0) ? (arg + (arg % 2)) / 2 : arg;
arg = 1;
break;
@@ -691,6 +692,8 @@
len = size * 2;
}
+ len -= argb % 2;
+
buf = emalloc(len + 1);
for (ipos = opos = 0; opos < len; opos++) {
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/tests/strings/bug35817.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/strings/bug35817.phpt
+++ php-src/ext/standard/tests/strings/bug35817.phpt