blob: f0e7a6badf7431402feb87c2f32add5acabc5a28 (
plain)
1 From 0f0fbc07d9be31f5e83ec5328d7311fdfd8328b1 Mon Sep 17 00:00:00 2001
2 From: Tor Andersson <tor.andersson@artifex.com>
3 Date: Tue, 19 Sep 2017 16:33:38 +0200
4 Subject: [PATCH] Fix 698540: Check name, comment and meta size field signs.
5
6 ---
7 source/fitz/unzip.c | 3 +++
8 1 file changed, 3 insertions(+)
9
10 diff --git a/source/fitz/unzip.c b/source/fitz/unzip.c
11 index f2d4f32..0bcce0f 100644
12 --- a/source/fitz/unzip.c
13 +++ b/source/fitz/unzip.c
14 @@ -141,6 +141,9 @@ static void read_zip_dir_imp(fz_context *ctx, fz_zip_archive *zip, int start_off
15 (void) fz_read_int32_le(ctx, file); /* ext file atts */
16 offset = fz_read_int32_le(ctx, file);
17
18 + if (namesize < 0 || metasize < 0 || commentsize < 0)
19 + fz_throw(ctx, FZ_ERROR_GENERIC, "invalid size in zip entry");
20 +
21 name = fz_malloc(ctx, namesize + 1);
22 n = fz_read(ctx, file, (unsigned char*)name, namesize);
23 if (n < (size_t)namesize)
24 --
25 2.9.1
|