rar: Fix out ouf boundary access with large files (#2179)
If a header has the FHD_LARGE flag set, it is not verified that enough bytes have been read. Check boundaries before accessing the additional bytes.
This commit is contained in:
1 parent
cd95ec3b72
commit
34338d6c4b
1 file changed
+5
@@ -1469,6 +1469,11 @@ read_header(struct archive_read *a, struct archive_entry *entry,
|
||||
|
||||
if (rar->file_flags & FHD_LARGE)
|
||||
{
|
||||
if (p + 8 > endp) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
|
||||
"Invalid header size");
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
memcpy(packed_size, file_header.pack_size, 4);
|
||||
memcpy(packed_size + 4, p, 4); /* High pack size */
|
||||
p += 4;
|
||||
|
||||
Reference in new issue
Block a user