]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
rar: Clean up br on split archive entries (#2593)
authorTobias Stoeckmann <stoeckmann@users.noreply.github.com>
Fri, 9 May 2025 11:30:32 +0000 (13:30 +0200)
committerGitHub <noreply@github.com>
Fri, 9 May 2025 11:30:32 +0000 (13:30 +0200)
Reset avail_in and next_in if the next entry of a split archive is
parsed to always update its internal structure to access next bytes when
cache runs empty.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_read_support_format_rar.c

index 6f9e431d03cd199908a21365d919cef3b194ee1e..d3b91b1fbb8b6a42e637cc74389c4eb242bfc84b 100644 (file)
@@ -1673,6 +1673,8 @@ read_header(struct archive_read *a, struct archive_entry *entry,
     !memcmp(rar->filename, rar->filename_save, filename_size + 1))
   {
     __archive_read_consume(a, header_size - 7);
+    rar->br.avail_in = 0;
+    rar->br.next_in = NULL;
     rar->cursor++;
     if (rar->cursor >= rar->nodes)
     {
@@ -1783,6 +1785,7 @@ read_header(struct archive_read *a, struct archive_entry *entry,
   rar->offset_outgoing = 0;
   rar->br.cache_avail = 0;
   rar->br.avail_in = 0;
+  rar->br.next_in = NULL;
   rar->crc_calculated = 0;
   rar->entry_eof = 0;
   rar->valid = 1;