summaryrefslogtreecommitdiffstats
path: root/contrib/libarchive/libarchive/archive_read_support_format_lha.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-02-23 06:28:41 -0300
committerRenato Botelho <renato@netgate.com>2017-02-23 06:28:41 -0300
commit82ceeb2ea625cd9bff60f2863b9a0830f55b7905 (patch)
tree263ca9347bf664a4489743f9302e699ce14de1df /contrib/libarchive/libarchive/archive_read_support_format_lha.c
parent4a05f5440acda223e6a0ec5157bc32ecc0f09ff9 (diff)
parentd20dd8b36e7a565be7bfbb22aade51c8ffd753e9 (diff)
downloadFreeBSD-src-82ceeb2ea625cd9bff60f2863b9a0830f55b7905.zip
FreeBSD-src-82ceeb2ea625cd9bff60f2863b9a0830f55b7905.tar.gz
Merge remote-tracking branch 'origin/stable/10' into develdevel
Diffstat (limited to 'contrib/libarchive/libarchive/archive_read_support_format_lha.c')
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_lha.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_lha.c b/contrib/libarchive/libarchive/archive_read_support_format_lha.c
index a7f1d8d..d77a7c2 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_lha.c
+++ b/contrib/libarchive/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");
@@ -1711,7 +1714,7 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
*/
for (;len >= 8; len -= 8) {
/* This if statement expects compiler optimization will
- * remove the stament which will not be executed. */
+ * remove the statement which will not be executed. */
#undef bswap16
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */
# define bswap16(x) _byteswap_ushort(x)
OpenPOWER on IntegriCloud