From 3365b4bd58dd7f13e786caf3c7234cf8116263d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 25 Jul 2018 12:45:24 +0200 Subject: [PATCH] gcab: Fix regression from commit a15d91073fd5d6be25 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently, rewinding should reset the CDATA state. See also: https://bugzilla.redhat.com/show_bug.cgi?id=1608301 Signed-off-by: Marc-André Lureau --- libgcab/gcab-folder.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libgcab/gcab-folder.c b/libgcab/gcab-folder.c index 1b09fa3..c0d6600 100644 --- a/libgcab/gcab-folder.c +++ b/libgcab/gcab-folder.c @@ -423,6 +423,7 @@ gcab_folder_extract (GCabFolder *self, g_autoptr(GSList) files = NULL; g_autoptr(cdata_t) cdata = g_new0 (cdata_t, 1); guint32 nubytes = 0; + guint8 *reserved; /* never loaded from a stream */ g_assert (self->cfolder != NULL); @@ -433,7 +434,7 @@ gcab_folder_extract (GCabFolder *self, files = g_slist_sort (g_slist_copy (self->files), (GCompareFunc)sort_by_offset); /* this is allocated for every block, but currently unused */ - cdata->reserved = g_malloc (res_data); + cdata->reserved = reserved = g_malloc (res_data); for (f = files; f != NULL; f = f->next) { GCabFile *file = f->data; @@ -454,6 +455,8 @@ gcab_folder_extract (GCabFolder *self, if (!g_seekable_seek (G_SEEKABLE (data), self->cfolder->offsetdata, G_SEEK_SET, cancellable, error)) return FALSE; + bzero(cdata, sizeof(cdata_t)); + cdata->reserved = reserved; nubytes = 0; } -- 2.18.0.321.gffc6fa0e39