Skip to content

Commit 8c2b3b0

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix libmagic buffer overflow issue (CVE-2019-18218) bump version set versions for release
2 parents 736cd93 + 2bdb13a commit 8c2b3b0

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
@@ -989,8 +989,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
989989
goto out;
990990
}
991991
nelements = CDF_GETUINT32(q, 1);
992-
if (nelements == 0) {
993-
DPRINTF(("CDF_VECTOR with nelements == 0\n"));
992+
if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
993+
DPRINTF(("CDF_VECTOR with nelements == %"
994+
SIZE_T_FORMAT "u\n", nelements));
994995
goto out;
995996
}
996997
slen = 2;
@@ -1032,8 +1033,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
10321033
goto out;
10331034
inp += nelem;
10341035
}
1035-
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
1036-
nelements));
10371036
for (j = 0; j < nelements && i < sh.sh_properties;
10381037
j++, i++)
10391038
{

ext/fileinfo/libmagic/cdf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
typedef int32_t cdf_secid_t;
4949

5050
#define CDF_LOOP_LIMIT 10000
51+
#define CDF_ELEMENT_LIMIT 100000
5152

5253
#define CDF_SECID_NULL 0
5354
#define CDF_SECID_FREE -1

0 commit comments

Comments
 (0)