|
|
435ea7 |
From 68ce2d0ea6da79b12a365e375e1c2ce882c77480 Mon Sep 17 00:00:00 2001
|
|
|
435ea7 |
From: Stanislav Malyshev <stas@php.net>
|
|
|
435ea7 |
Date: Mon, 26 May 2014 17:50:14 -0700
|
|
|
435ea7 |
Subject: [PATCH] Fix bug #67328 (fileinfo: numerous file_printf calls
|
|
|
435ea7 |
resulting in performance degradation)
|
|
|
435ea7 |
|
|
|
435ea7 |
Upstream patch: https://github.com/file/file/commit/b8acc83781d5a24cc5101e525d15efe0482c280d
|
|
|
435ea7 |
---
|
|
|
435ea7 |
ext/fileinfo/libmagic/cdf.c | 16 ++++------------
|
|
|
435ea7 |
1 file changed, 4 insertions(+), 12 deletions(-)
|
|
|
435ea7 |
|
|
|
435ea7 |
diff --git a/ext/fileinfo/libmagic/cdf.c b/ext/fileinfo/libmagic/cdf.c
|
|
|
435ea7 |
index dd7177e..8dacd2f 100644
|
|
|
435ea7 |
--- a/src/cdf.c
|
|
|
435ea7 |
+++ b/src/cdf.c
|
|
|
435ea7 |
@@ -929,7 +929,7 @@ int
|
|
|
435ea7 |
cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
|
|
435ea7 |
cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
|
|
|
435ea7 |
{
|
|
|
435ea7 |
- size_t i, maxcount;
|
|
|
435ea7 |
+ size_t maxcount;
|
|
|
435ea7 |
const cdf_summary_info_header_t *si =
|
|
|
435ea7 |
CAST(const cdf_summary_info_header_t *, sst->sst_tab);
|
|
|
435ea7 |
const cdf_section_declaration_t *sd =
|
|
|
435ea7 |
@@ -944,21 +944,13 @@ cdf_unpack_summary_info(const cdf_stream_t *sst, const cdf_header_t *h,
|
|
|
435ea7 |
ssi->si_os = CDF_TOLE2(si->si_os);
|
|
|
435ea7 |
ssi->si_class = si->si_class;
|
|
|
435ea7 |
cdf_swap_class(&ssi->si_class);
|
|
|
435ea7 |
- ssi->si_count = CDF_TOLE2(si->si_count);
|
|
|
435ea7 |
+ ssi->si_count = CDF_TOLE4(si->si_count);
|
|
|
435ea7 |
*count = 0;
|
|
|
435ea7 |
maxcount = 0;
|
|
|
435ea7 |
*info = NULL;
|
|
|
435ea7 |
- for (i = 0; i < CDF_TOLE4(si->si_count); i++) {
|
|
|
435ea7 |
- if (i >= CDF_LOOP_LIMIT) {
|
|
|
435ea7 |
- DPRINTF(("Unpack summary info loop limit"));
|
|
|
435ea7 |
- errno = EFTYPE;
|
|
|
435ea7 |
- return -1;
|
|
|
435ea7 |
- }
|
|
|
435ea7 |
- if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset),
|
|
|
435ea7 |
- info, count, &maxcount) == -1) {
|
|
|
435ea7 |
+ if (cdf_read_property_info(sst, h, CDF_TOLE4(sd->sd_offset), info,
|
|
|
435ea7 |
+ count, &maxcount) == -1)
|
|
|
435ea7 |
return -1;
|
|
|
435ea7 |
- }
|
|
|
435ea7 |
- }
|
|
|
435ea7 |
return 0;
|
|
|
435ea7 |
}
|
|
|
435ea7 |
|
|
|
435ea7 |
--
|
|
|
435ea7 |
1.9.2
|
|
|
435ea7 |
|