mirror of
https://github.com/bdnugget/php-src.git
synced 2026-11-11 03:00:49 +00:00
Compare commits
8
Commits
php-5.5.35
...
PHP-5.4.26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60c5de5cd7 | ||
|
|
c9a6c62b41 | ||
|
|
71e21e17a1 | ||
|
|
fc8f0c34f7 | ||
|
|
43d220603c | ||
|
|
0658e65f64 | ||
|
|
fdb9b6e5ec | ||
|
|
cbf5581d82 |
No files matched your search
@@ -1,13 +1,15 @@
|
||||
PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2014, PHP 5.4.26
|
||||
|
||||
?? ??? 2014, PHP 5.4.26
|
||||
06 Mar 2014, PHP 5.4.26
|
||||
|
||||
- JSON:
|
||||
. Fixed bug #65753 (JsonSerializeable couldn't implement on module extension)
|
||||
(chobieeee@php.net)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #66731 (file: infinite recursion). (CVE-2014-1943) (Remi)
|
||||
. Fixed bug #66820 (out-of-bounds memory access in fileinfo) (Remi)
|
||||
|
||||
- LDAP:
|
||||
. Implemented ldap_modify_batch (https://wiki.php.net/rfc/ldap_modify_batch).
|
||||
(Ondřej Hošek)
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ int zend_sprintf(char *buffer, const char *format, ...);
|
||||
PHP_MAJOR_VERSION=5
|
||||
PHP_MINOR_VERSION=4
|
||||
PHP_RELEASE_VERSION=26
|
||||
PHP_EXTRA_VERSION="-dev"
|
||||
PHP_EXTRA_VERSION=""
|
||||
PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION"
|
||||
PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION`
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf,
|
||||
== NULL)
|
||||
goto done;
|
||||
if ((rv = file_softmagic(ms, utf8_buf,
|
||||
(size_t)(utf8_end - utf8_buf), TEXTTEST, text)) == 0)
|
||||
(size_t)(utf8_end - utf8_buf), 0, TEXTTEST, text)) == 0)
|
||||
rv = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,7 +437,7 @@ protected int file_encoding(struct magic_set *, const unsigned char *, size_t,
|
||||
unichar **, size_t *, const char **, const char **, const char **);
|
||||
protected int file_is_tar(struct magic_set *, const unsigned char *, size_t);
|
||||
protected int file_softmagic(struct magic_set *, const unsigned char *, size_t,
|
||||
int, int);
|
||||
size_t, int, int);
|
||||
protected int file_apprentice(struct magic_set *, const char *, int);
|
||||
protected int file_magicfind(struct magic_set *, const char *, struct mlist *);
|
||||
protected uint64_t file_signextend(struct magic_set *, struct magic *,
|
||||
|
||||
@@ -235,7 +235,7 @@ file_buffer(struct magic_set *ms, php_stream *stream, const char *inname, const
|
||||
|
||||
/* try soft magic tests */
|
||||
if ((ms->flags & MAGIC_NO_CHECK_SOFT) == 0)
|
||||
if ((m = file_softmagic(ms, ubuf, nb, BINTEST,
|
||||
if ((m = file_softmagic(ms, ubuf, nb, 0, BINTEST,
|
||||
looks_text)) != 0) {
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
(void)fprintf(stderr, "softmagic %d\n", m);
|
||||
|
||||
@@ -67,6 +67,8 @@ private void cvt_16(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_32(union VALUETYPE *, const struct magic *);
|
||||
private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
|
||||
#define OFFSET_OOB(n, o, i) ((n) < (o) || (i) > ((n) - (o)))
|
||||
|
||||
/*
|
||||
* softmagic - lookup one file in parsed, in-memory copy of database
|
||||
* Passed the name and FILE * of one file to be typed.
|
||||
@@ -74,13 +76,13 @@ private void cvt_64(union VALUETYPE *, const struct magic *);
|
||||
/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */
|
||||
protected int
|
||||
file_softmagic(struct magic_set *ms, const unsigned char *buf, size_t nbytes,
|
||||
int mode, int text)
|
||||
size_t level, int mode, int text)
|
||||
{
|
||||
struct mlist *ml;
|
||||
int rv, printed_something = 0, need_separator = 0;
|
||||
for (ml = ms->mlist[0]->next; ml != ms->mlist[0]; ml = ml->next)
|
||||
if ((rv = match(ms, ml->magic, ml->nmagic, buf, nbytes, 0, mode,
|
||||
text, 0, 0, &printed_something, &need_separator,
|
||||
text, 0, level, &printed_something, &need_separator,
|
||||
NULL)) != 0)
|
||||
return rv;
|
||||
|
||||
@@ -1171,7 +1173,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
}
|
||||
switch (cvt_flip(m->in_type, flip)) {
|
||||
case FILE_BYTE:
|
||||
if (nbytes < (offset + 1))
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1206,7 +1208,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_BESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1258,7 +1260,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1310,7 +1312,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_SHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1347,7 +1349,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
break;
|
||||
case FILE_BELONG:
|
||||
case FILE_BEID3:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1418,7 +1420,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
break;
|
||||
case FILE_LELONG:
|
||||
case FILE_LEID3:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1488,7 +1490,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_MELONG:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1558,7 +1560,7 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
offset = ~offset;
|
||||
break;
|
||||
case FILE_LONG:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
if (off) {
|
||||
switch (m->in_op & FILE_OPS_MASK) {
|
||||
@@ -1630,14 +1632,14 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
/* Verify we have enough data to match magic type */
|
||||
switch (m->type) {
|
||||
case FILE_BYTE:
|
||||
if (nbytes < (offset + 1)) /* should always be true */
|
||||
if (OFFSET_OOB(nbytes, offset, 1))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_SHORT:
|
||||
case FILE_BESHORT:
|
||||
case FILE_LESHORT:
|
||||
if (nbytes < (offset + 2))
|
||||
if (OFFSET_OOB(nbytes, offset, 2))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
@@ -1656,55 +1658,67 @@ mget(struct magic_set *ms, const unsigned char *s, struct magic *m,
|
||||
case FILE_FLOAT:
|
||||
case FILE_BEFLOAT:
|
||||
case FILE_LEFLOAT:
|
||||
if (nbytes < (offset + 4))
|
||||
if (OFFSET_OOB(nbytes, offset, 4))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_DOUBLE:
|
||||
case FILE_BEDOUBLE:
|
||||
case FILE_LEDOUBLE:
|
||||
if (nbytes < (offset + 8))
|
||||
if (OFFSET_OOB(nbytes, offset, 8))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_STRING:
|
||||
case FILE_PSTRING:
|
||||
case FILE_SEARCH:
|
||||
if (nbytes < (offset + m->vallen))
|
||||
if (OFFSET_OOB(nbytes, offset, m->vallen))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_REGEX:
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case FILE_INDIRECT:
|
||||
if (nbytes < offset)
|
||||
if (offset == 0)
|
||||
return 0;
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = ms->o.buf;
|
||||
soffset = ms->offset;
|
||||
ms->o.buf = NULL;
|
||||
ms->offset = 0;
|
||||
rv = file_softmagic(ms, s + offset, nbytes - offset,
|
||||
BINTEST, text);
|
||||
recursion_level, BINTEST, text);
|
||||
if ((ms->flags & MAGIC_DEBUG) != 0)
|
||||
fprintf(stderr, "indirect @offs=%u[%d]\n", offset, rv);
|
||||
rbuf = ms->o.buf;
|
||||
ms->o.buf = sbuf;
|
||||
ms->offset = soffset;
|
||||
if (rv == 1) {
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1)
|
||||
return -1;
|
||||
if (file_printf(ms, "%s", rbuf) == -1)
|
||||
if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 &&
|
||||
file_printf(ms, m->desc, offset) == -1) {
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (file_printf(ms, "%s", rbuf) == -1) {
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (rbuf) {
|
||||
efree(rbuf);
|
||||
}
|
||||
return rv;
|
||||
|
||||
case FILE_USE:
|
||||
if (nbytes < offset)
|
||||
if (OFFSET_OOB(nbytes, offset, 0))
|
||||
return 0;
|
||||
sbuf = m->value.s;
|
||||
if (*sbuf == '^') {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Bug #66731: file: infinite recursion
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('finfo'))
|
||||
die('skip no fileinfo extension');
|
||||
--FILE--
|
||||
<?php
|
||||
$fd = __DIR__.'/cve-2014-1943.data';
|
||||
$fm = __DIR__.'/cve-2014-1943.magic';
|
||||
|
||||
$a = "\105\122\000\000\000\000\000";
|
||||
$b = str_repeat("\001", 250000);
|
||||
$m = "0 byte x\n".
|
||||
">(1.b) indirect x\n";
|
||||
|
||||
file_put_contents($fd, $a);
|
||||
$fi = finfo_open(FILEINFO_NONE);
|
||||
var_dump(finfo_file($fi, $fd));
|
||||
finfo_close($fi);
|
||||
|
||||
file_put_contents($fd, $b);
|
||||
file_put_contents($fm, $m);
|
||||
$fi = finfo_open(FILEINFO_NONE, $fm);
|
||||
var_dump(finfo_file($fi, $fd));
|
||||
finfo_close($fi);
|
||||
?>
|
||||
Done
|
||||
--CLEAN--
|
||||
<?php
|
||||
@unlink(__DIR__.'/cve-2014-1943.data');
|
||||
@unlink(__DIR__.'/cve-2014-1943.magic');
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
|
||||
Warning: finfo_file(): Failed identify data 0:(null) in %s on line %d
|
||||
bool(false)
|
||||
Done
|
||||
+2
-2
@@ -3,6 +3,6 @@
|
||||
#define PHP_MAJOR_VERSION 5
|
||||
#define PHP_MINOR_VERSION 4
|
||||
#define PHP_RELEASE_VERSION 26
|
||||
#define PHP_EXTRA_VERSION "-dev"
|
||||
#define PHP_VERSION "5.4.26-dev"
|
||||
#define PHP_EXTRA_VERSION ""
|
||||
#define PHP_VERSION "5.4.26"
|
||||
#define PHP_VERSION_ID 50426
|
||||
Reference in new issue
Block a user