|
|
2e421e |
From 1abcbf1af5209631ccf4fca4ddcab3c863294c85 Mon Sep 17 00:00:00 2001
|
|
|
2e421e |
From: =?UTF-8?q?Patrik=20Novotn=C3=BD?= <panovotn@redhat.com>
|
|
|
2e421e |
Date: Wed, 15 Jan 2020 16:10:04 +0100
|
|
|
2e421e |
Subject: [PATCH] RAR reader: fix use after free
|
|
|
2e421e |
|
|
|
2e421e |
If read_data_compressed() returns ARCHIVE_FAILED, the caller is allowed
|
|
|
2e421e |
to continue with next archive headers. We need to set rar->start_new_table
|
|
|
2e421e |
after the ppmd7_context got freed, otherwise it won't be allocated again.
|
|
|
2e421e |
---
|
|
|
2e421e |
libarchive/archive_read_support_format_rar.c | 4 +++-
|
|
|
2e421e |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
2e421e |
|
|
|
2e421e |
diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c
|
|
|
2e421e |
index cbb14c32..9c26ef97 100644
|
|
|
2e421e |
--- a/libarchive/archive_read_support_format_rar.c
|
|
|
2e421e |
+++ b/libarchive/archive_read_support_format_rar.c
|
|
|
2e421e |
@@ -1037,8 +1037,10 @@ archive_read_format_rar_read_data(struct archive_read *a, const void **buff,
|
|
|
2e421e |
case COMPRESS_METHOD_GOOD:
|
|
|
2e421e |
case COMPRESS_METHOD_BEST:
|
|
|
2e421e |
ret = read_data_compressed(a, buff, size, offset);
|
|
|
2e421e |
- if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN)
|
|
|
2e421e |
+ if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) {
|
|
|
41dfe1 |
__archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context);
|
|
|
2e421e |
+ rar->start_new_table = 1;
|
|
|
2e421e |
+ }
|
|
|
2e421e |
break;
|
|
|
2e421e |
|
|
|
2e421e |
default:
|
|
|
2e421e |
--
|
|
|
2e421e |
2.24.1
|
|
|
2e421e |
|