Skip to content

Commit 2bdb13a

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix libmagic buffer overflow issue (CVE-2019-18218) bump version set versions for release
2 parents 89c327f + 4698200 commit 2bdb13a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/fileinfo/libmagic/cdf.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,8 +1011,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
10111011
goto out;
10121012
}
10131013
nelements = CDF_GETUINT32(q, 1);
1014-
if (nelements == 0) {
1015-
DPRINTF(("CDF_VECTOR with nelements == 0\n"));
1014+
if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
1015+
DPRINTF(("CDF_VECTOR with nelements == %"
1016+
SIZE_T_FORMAT "u\n", nelements));
10161017
goto out;
10171018
}
10181019
slen = 2;
@@ -1054,8 +1055,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
10541055
goto out;
10551056
inp += nelem;
10561057
}
1057-
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
1058-
nelements));
10591058
for (j = 0; j < nelements && i < sh.sh_properties;
10601059
j++, i++)
10611060
{

ext/fileinfo/libmagic/cdf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
typedef int32_t cdf_secid_t;
5151

5252
#define CDF_LOOP_LIMIT 10000
53+
#define CDF_ELEMENT_LIMIT 100000
5354

5455
#define CDF_SECID_NULL 0
5556
#define CDF_SECID_FREE -1

0 commit comments

Comments
 (0)