Skip to content

Commit 2c8c83b

Browse files
committed
Reject LHA archive entries with negative size.
1 parent a864f9f commit 2c8c83b

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

libarchive/archive_read_support_format_lha.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,12 @@ archive_read_format_lha_read_header(struct archive_read *a,
701701
* Prepare variables used to read a file content.
702702
*/
703703
lha->entry_bytes_remaining = lha->compsize;
704+
if (lha->entry_bytes_remaining < 0) {
705+
archive_set_error(&a->archive,
706+
ARCHIVE_ERRNO_FILE_FORMAT,
707+
"Invalid LHa entry size");
708+
return (ARCHIVE_FATAL);
709+
}
704710
lha->entry_offset = 0;
705711
lha->entry_crc_calculated = 0;
706712

0 commit comments

Comments
 (0)