Permalink
Browse files

Fail with negative lha->compsize in lha_read_file_header_1()

Fixes a heap buffer overflow reported in Secunia SA74169
  • Loading branch information...
mmatuska committed Jan 19, 2017
1 parent 42f7080 commit 98dcbbf0bf4854bf987557e55e55fff7abbf3ea9
Showing with 3 additions and 0 deletions.
  1. +3 −0 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");

1 comment on commit 98dcbbf

@carnil

This comment has been minimized.

Copy link

carnil commented on 98dcbbf Jan 31, 2017

This is CVE-2017-5601

Please sign in to comment.