1
0
forked from pool/libmirage
libmirage/0002-libMirage-CSO-filter-replaced-a-g_assert-with-error-.patch
Jan Engelhardt 217c4be070 - Drop SLE11 recipes from specfile, the build is disabled anyway.
- Add 0001-libMirage-CSO-filter-validate-part-size.patch,
  0002-libMirage-CSO-filter-replaced-a-g_assert-with-error-.patch
  [boo#1148087, CVE-2019-15540]

OBS-URL: https://build.opensuse.org/package/show/filesystems/libmirage?expand=0&rev=53
2019-08-26 08:30:40 +00:00

38 lines
1.8 KiB
Diff

From f6adcd08beffd9dac2c4a86852ba0bda06870f4f Mon Sep 17 00:00:00 2001
From: Rok Mandeljc <rok.mandeljc@gmail.com>
Date: Sun, 25 Aug 2019 15:11:23 +0200
Subject: [PATCH 2/2] libMirage: CSO filter: replaced a g_assert() with error
return
---
libmirage/filters/filter-cso/filter-stream.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/libmirage/filters/filter-cso/filter-stream.c b/libmirage/filters/filter-cso/filter-stream.c
index d43aa54a..065dc40c 100644
--- a/libmirage/filters/filter-cso/filter-stream.c
+++ b/libmirage/filters/filter-cso/filter-stream.c
@@ -70,12 +70,17 @@ static gboolean mirage_filter_stream_cso_read_index (MirageFilterStreamCso *self
MIRAGE_DEBUG(self, MIRAGE_DEBUG_PARSER, "%s: reading part index\n", __debug__);
+ if (header->total_bytes % header->block_size) {
+ MIRAGE_DEBUG(self, MIRAGE_DEBUG_WARNING, "%s: original stream size (%" G_GUINT64_FORMAT ") is not a multiple of block size (%d)!\n", __debug__, header->total_bytes, header->block_size);
+ g_set_error(error, MIRAGE_ERROR, MIRAGE_ERROR_STREAM_ERROR, Q_("Invalid CSO file!"));
+ return FALSE;
+ }
+
self->priv->num_parts = header->total_bytes / header->block_size;
self->priv->num_indices = self->priv->num_parts + 1; /* Contains EOF offset */
- g_assert(header->total_bytes % header->block_size == 0);
MIRAGE_DEBUG(self, MIRAGE_DEBUG_PARSER, "%s: number of parts: %d\n", __debug__, self->priv->num_parts);
- MIRAGE_DEBUG(self, MIRAGE_DEBUG_PARSER, "%s: original stream size: %" G_GINT64_MODIFIER "d\n", __debug__, header->total_bytes);
+ MIRAGE_DEBUG(self, MIRAGE_DEBUG_PARSER, "%s: original stream size: 0x%" G_GINT64_MODIFIER "X (%" G_GUINT64_FORMAT ")\n", __debug__, header->total_bytes, header->total_bytes);
/* At least one part must be present */
if (!self->priv->num_parts) {
--
2.22.1