com php-src: Fixed Bug #67411 fileinfo: cdf_check_st ream_offset insufficient boundary check: ext/filein fo/libmagic/cdf.c
| From: | Remi Collet | Date: | Tue, 10 Jun 2014 12:13:14 +0000 |
| Subject: | com php-src: Fixed Bug #67411 fileinfo: cdf_check_st ream_offset insufficient boundary check: ext/filein fo/libmagic/cdf.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78800@lists.php.net to get a copy of this message | ||
Commit: 5c9f96799961818944d43b22c241cc56c215c2e4
Author: Remi Collet <remi@php.net> Tue, 10 Jun 2014 14:13:14 +0200
Parents: d02aa440909b7a20098ccc9d3820629a36037596
Branches: PHP-5.4 PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5c9f96799961818944d43b22c241cc56c215c2e4
Log:
Fixed Bug #67411 fileinfo: cdf_check_stream_offset insufficient boundary check
Upstream:
https://github.com/file/file/commit/36fadd29849b8087af9f4586f89dbf74ea45be67
Bugs:
https://bugs.php.net/67411
Changed paths:
M ext/fileinfo/libmagic/cdf.c
Diff:
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
index 16649f1..c9a5d50 100644
--- a/ext/fileinfo/libmagic/cdf.c
+++ b/ext/fileinfo/libmagic/cdf.c
@@ -277,13 +277,15 @@ cdf_check_stream_offset(const cdf_stream_t *sst, const cdf_header_t *h,
{
const char *b = (const char *)sst->sst_tab;
const char *e = ((const char *)p) + tail;
+ size_t ss = sst->sst_dirlen < h->h_min_size_standard_stream ?
+ CDF_SHORT_SEC_SIZE(h) : CDF_SEC_SIZE(h);
(void)&line;
- if (e >= b && (size_t)(e - b) <= CDF_SEC_SIZE(h) * sst->sst_len)
+ if (e >= b && (size_t)(e - b) <= ss * sst->sst_len)
return 0;
DPRINTF(("%d: offset begin %p < end %p || %" SIZE_T_FORMAT "u"
" > %" SIZE_T_FORMAT "u [%" SIZE_T_FORMAT "u %"
SIZE_T_FORMAT "u]\n", line, b, e, (size_t)(e - b),
- CDF_SEC_SIZE(h) * sst->sst_len, CDF_SEC_SIZE(h), sst->sst_len));
+ ss * sst->sst_len, ss, sst->sst_len));
errno = EFTYPE;
return -1;
}