summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Matuska <martin@matuska.org>2017-01-19 22:00:18 +0100
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-06-20 13:24:01 +0900
commit64f70328ec28c3b405b7e498ef84da632400791c (patch)
tree883ea38d03156fac8206c996cbedb36356ba6226
parenteed4fe1dff659918000f38c1586118ddc61c35f9 (diff)
downloadlibarchive-64f70328ec28c3b405b7e498ef84da632400791c.tar.gz
libarchive-64f70328ec28c3b405b7e498ef84da632400791c.tar.bz2
libarchive-64f70328ec28c3b405b7e498ef84da632400791c.zip
Fail with negative lha->compsize in lha_read_file_header_1() Fixes a heap buffer overflow reported in Secunia SA74169submit/tizen_base/20170620.051947
Change-Id: Ifd42aa5e066d5ac401c934406552ae0fa311730e Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rw-r--r--libarchive/archive_read_support_format_lha.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c
index c359d83..1a5617f 100644
--- a/libarchive/archive_read_support_format_lha.c
+++ b/libarchive/archive_read_support_format_lha.c
@@ -924,6 +924,9 @@ lha_read_file_header_1(struct archive_read *a, struct lha *lha)
/* Get a real compressed file size. */
lha->compsize -= extdsize - 2;
+ if (lha->compsize < 0)
+ goto invalid; /* Invalid compressed file size */
+
if (sum_calculated != headersum) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"LHa header sum error");