[gnome-autoar] Fix segmentation fault when the input archive is empty
- From: Ting-Wei Lan <lantw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar] Fix segmentation fault when the input archive is empty
- Date: Tue, 14 Oct 2014 09:11:52 +0000 (UTC)
commit 0300e4b31253779541a6f078ca45bd7a3bd6e7db
Author: Ting-Wei Lan <lantw src gnome org>
Date: Tue Oct 14 16:46:45 2014 +0800
Fix segmentation fault when the input archive is empty
gnome-autoar/autoar-extract.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gnome-autoar/autoar-extract.c b/gnome-autoar/autoar-extract.c
index 65a49d0..c5886e6 100644
--- a/gnome-autoar/autoar-extract.c
+++ b/gnome-autoar/autoar-extract.c
@@ -96,6 +96,7 @@ G_DEFINE_QUARK (autoar-extract, autoar_extract)
#define BUFFER_SIZE (64 * 1024)
#define NOT_AN_ARCHIVE_ERRNO 2013
+#define EMPTY_ARCHIVE_ERRNO 2014
typedef struct _GFileAndInfo GFileAndInfo;
@@ -1797,6 +1798,15 @@ autoar_extract_step_scan_toplevel (AutoarExtract *arextract)
archive_read_data_skip (a);
}
+ if (pathname_prefix == NULL) {
+ if (priv->error == NULL) {
+ priv->error = g_error_new (AUTOAR_EXTRACT_ERROR, EMPTY_ARCHIVE_ERRNO,
+ "\'%s\': %s", priv->source, "empty archive");
+ }
+ archive_read_free (a);
+ return;
+ }
+
if (r != ARCHIVE_EOF) {
if (priv->error == NULL) {
priv->error = autoar_common_g_error_new_a (a, priv->source);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]