Skip to content

Commit 53b1d76

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix libmagic buffer overflow issue (CVE-2019-18218) bump version set versions for release
2 parents 3fb42a3 + 8c2b3b0 commit 53b1d76

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
@@ -995,8 +995,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
995995
goto out;
996996
}
997997
nelements = CDF_GETUINT32(q, 1);
998-
if (nelements == 0) {
999-
DPRINTF(("CDF_VECTOR with nelements == 0\n"));
998+
if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
999+
DPRINTF(("CDF_VECTOR with nelements == %"
1000+
SIZE_T_FORMAT "u\n", nelements));
10001001
goto out;
10011002
}
10021003
slen = 2;
@@ -1038,8 +1039,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
10381039
goto out;
10391040
inp += nelem;
10401041
}
1041-
DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
1042-
nelements));
10431042
for (j = 0; j < nelements && i < sh.sh_properties;
10441043
j++, i++)
10451044
{

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)