[gnome-autoar/gnome-3-22] AutoarExtractor: check encrypted entry after header is read



commit 7755476fb6794a85189202c4c9de0adee04b9477
Author: Razvan Chitu <razvan ch95 gmail com>
Date:   Fri Sep 30 13:49:07 2016 +0300

    AutoarExtractor: check encrypted entry after header is read
    
    If an archive has an encrypted header, libarchive will return a fatal error code
    when attempting to read it. This is a problem because it will skip the
    verification for encrypted entries. In order to fix this, check if entries are
    encrypted outside of the header reading loop.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772246

 gnome-autoar/autoar-extractor.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index 31d9fa1..b42b9cd 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1589,13 +1589,7 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
     }
 
     if (archive_entry_is_encrypted (entry)) {
-      if (self->error == NULL) {
-        self->error = g_error_new (G_IO_ERROR,
-                                   G_IO_ERROR_NOT_SUPPORTED,
-                                   "Encrypted archives are not supported.");
-      }
-      archive_read_free (a);
-      return;
+      break;
     }
 
     pathname = archive_entry_pathname (entry);
@@ -1610,6 +1604,17 @@ autoar_extractor_step_scan_toplevel (AutoarExtractor *self)
     archive_read_data_skip (a);
   }
 
+  if (entry && archive_entry_is_encrypted (entry)) {
+    g_debug ("autoar_extractor_step_scan_toplevel: encrypted entry");
+    if (self->error == NULL) {
+      self->error = g_error_new (G_IO_ERROR,
+                                 G_IO_ERROR_NOT_SUPPORTED,
+                                 "Encrypted archives are not supported.");
+    }
+    archive_read_free (a);
+    return;
+  }
+
   if (self->files_list == NULL) {
     if (self->error == NULL) {
       self->error = g_error_new (AUTOAR_EXTRACTOR_ERROR,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]