Skip to content

Commit ae4e3d2

Browse files
authored
7zip: Limit amount of properties (libarchive#2131)
The uint64_t variable propertiesSize is eventually casted to size_t which, on 32 bit systems, can result in integer truncation. In such a situation, it is possible that less than the minimum of 5 properties are parsed and processed, which will result in out of boundary reads in init_decompression because the error check `if (coder1->propertiesSize < 5)` still takes the uint64_t variable into account.
1 parent 27d2ff3 commit ae4e3d2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

libarchive/archive_read_support_format_7zip.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,6 +2037,8 @@ read_Folder(struct archive_read *a, struct _7z_folder *f)
20372037
if (parse_7zip_uint64(
20382038
a, &(f->coders[i].propertiesSize)) < 0)
20392039
return (-1);
2040+
if (UMAX_ENTRY < f->coders[i].propertiesSize)
2041+
return (-1);
20402042
if ((p = header_bytes(
20412043
a, (size_t)f->coders[i].propertiesSize)) == NULL)
20422044
return (-1);

0 commit comments

Comments
 (0)