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