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