[gcab] libgcab: warn if compression is not supported
- From: Marc-Andre Lureau <malureau src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcab] libgcab: warn if compression is not supported
- Date: Fri, 25 Jan 2013 21:08:26 +0000 (UTC)
commit dba7137032aa2a8c4d66e9aee50cabe63bb45d75
Author: Marc-Andrà Lureau <marcandre lureau gmail com>
Date: Fri Jan 25 22:06:48 2013 +0100
libgcab: warn if compression is not supported
libgcab/cabinet.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libgcab/cabinet.c b/libgcab/cabinet.c
index c0e40ea..bc913b2 100644
--- a/libgcab/cabinet.c
+++ b/libgcab/cabinet.c
@@ -16,6 +16,11 @@ zfree (voidpf opaque, voidpf address)
static gboolean
cdata_set (cdata_t *cd, int type, guint8 *data, size_t size)
{
+ if (type > GCAB_COMPRESSION_MSZIP) {
+ g_critical (_("unsupported compression method"));
+ return FALSE;
+ }
+
cd->nubytes = size;
if (type == 0) {
@@ -429,6 +434,12 @@ cdata_read (cdata_t *cd, u1 res_data, GCabCompression compression,
int zret = Z_OK;
gchar *buf = compression == GCAB_COMPRESSION_NONE ? cd->out : cd->in;
+ if (compression > GCAB_COMPRESSION_MSZIP) {
+ g_set_error (error, GCAB_ERROR, GCAB_ERROR_FAILED,
+ _("unsupported compression method %d"), compression);
+ return FALSE;
+ }
+
R4 (cd->checksum);
R2 (cd->ncbytes);
R2 (cd->nubytes);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]