|
|
af9dc8 |
From 5c9f96799961818944d43b22c241cc56c215c2e4 Mon Sep 17 00:00:00 2001
|
|
|
af9dc8 |
From: Remi Collet <remi@php.net>
|
|
|
af9dc8 |
Date: Tue, 10 Jun 2014 14:13:14 +0200
|
|
|
af9dc8 |
Subject: [PATCH] Fixed Bug #67411 fileinfo: cdf_check_stream_offset
|
|
|
af9dc8 |
insufficient boundary check
|
|
|
af9dc8 |
|
|
|
af9dc8 |
Upstream:
|
|
|
af9dc8 |
https://github.com/file/file/commit/36fadd29849b8087af9f4586f89dbf74ea45be67
|
|
|
af9dc8 |
---
|
|
|
af9dc8 |
ext/fileinfo/libmagic/cdf.c | 6 ++++--
|
|
|
af9dc8 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
af9dc8 |
|
|
|
af9dc8 |
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
|
|
|
af9dc8 |
index 16649f1..c9a5d50 100644
|
|
|
af9dc8 |
--- a/ext/fileinfo/libmagic/cdf.c
|
|
|
af9dc8 |
+++ b/ext/fileinfo/libmagic/cdf.c
|
|
|
af9dc8 |
@@ -277,13 +277,15 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
|
|
|
af9dc8 |
{
|
|
|
af9dc8 |
const char *b = (const char *)sst->sst_tab;
|
|
|
af9dc8 |
const char *e = ((const char *)p) + tail;
|
|
|
af9dc8 |
+ size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
|
|
|
af9dc8 |
+ CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
|
|
|
af9dc8 |
(void)&line;
|
|
|
af9dc8 |
- if (e >= b && (size_t)(e - b) <= CDF_SEC_SIZE(h) * sst->sst_len)
|
|
|
af9dc8 |
+ if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
|
|
|
af9dc8 |
return 0;
|
|
|
af9dc8 |
DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
|
|
|
af9dc8 |
" > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
|
|
|
af9dc8 |
SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
|
|
|
af9dc8 |
- CDF_SEC_SIZE(h) * sst->sst_len, CDF_SEC_SIZE(h), sst->sst_len));
|
|
|
af9dc8 |
+ ss * sst->sst_len, ss, sst->sst_len));
|
|
|
af9dc8 |
errno = EFTYPE;
|
|
|
af9dc8 |
return -1;
|
|
|
af9dc8 |
}
|
|
|
af9dc8 |
--
|
|
|
af9dc8 |
1.9.2
|
|
|
af9dc8 |
|