d2399a
From 25b1dc917a53787dbb2532721ca22f3f36eb13c0 Mon Sep 17 00:00:00 2001
d2399a
From: Remi Collet <remi@php.net>
d2399a
Date: Tue, 10 Jun 2014 14:33:37 +0200
d2399a
Subject: [PATCH] Fixed Bug #67413 	fileinfo: cdf_read_property_info
d2399a
 insufficient boundary chec
d2399a
d2399a
Upstream:
d2399a
https://github.com/file/file/commit/93e063ee374b6a75729df9e7201fb511e47e259d
d2399a
d2399a
Adapted for C standard.
d2399a
---
d2399a
 ext/fileinfo/libmagic/cdf.c | 6 +++++-
d2399a
 1 file changed, 5 insertions(+), 1 deletion(-)
d2399a
d2399a
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
d2399a
index ee467a6..429f3b9 100644
d2399a
--- a/ext/fileinfo/libmagic/cdf.c
d2399a
+++ b/ext/fileinfo/libmagic/cdf.c
d2399a
@@ -812,7 +812,11 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
d2399a
 	if (cdf_check_stream_offset(sst, h, e, 0, __LINE__) == -1)
d2399a
 		goto out;
d2399a
 	for (i = 0; i < sh.sh_properties; i++) {
d2399a
-		size_t ofs = CDF_GETUINT32(p, (i << 1) + 1);
d2399a
+		size_t ofs, tail = (i << 1) + 1;
d2399a
+		if (cdf_check_stream_offset(sst, h, p, tail * sizeof(uint32_t),
d2399a
+		    __LINE__) == -1)
d2399a
+			goto out;
d2399a
+		ofs = CDF_GETUINT32(p, tail);
d2399a
 		q = (const uint8_t *)(const void *)
d2399a
 		    ((const char *)(const void *)p + ofs
d2399a
 		    - 2 * sizeof(uint32_t));
d2399a
-- 
d2399a
1.9.2
d2399a