Blame SOURCES/0002-lz-Avoid-buffer-reading-overflow-checking-for-image-.patch

e8160e
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e8160e
From: Frediano Ziglio <fziglio@redhat.com>
e8160e
Date: Fri, 22 Dec 2017 18:43:00 +0000
e8160e
Subject: [PATCH spice-common 1/2] lz: Avoid buffer reading overflow checking
e8160e
 for image type
e8160e
e8160e
The type of the image is just copied from network without
e8160e
any check and later used for array indexing.
e8160e
e8160e
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
e8160e
Acked-by: Uri Lublin <uril@redhat.com>
e8160e
---
e8160e
 common/lz.c | 3 +++
e8160e
 1 file changed, 3 insertions(+)
e8160e
e8160e
diff --git a/spice-common/common/lz.c b/spice-common/common/lz.c
e8160e
index 87c13db..2c5d5e2 100644
e8160e
--- a/spice-common/common/lz.c
e8160e
+++ b/spice-common/common/lz.c
e8160e
@@ -593,6 +593,9 @@ void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes,
e8160e
     }
e8160e
 
e8160e
     encoder->type = (LzImageType)decode_32(encoder);
e8160e
+    if (encoder->type <= LZ_IMAGE_TYPE_INVALID || encoder->type > LZ_IMAGE_TYPE_A8) {
e8160e
+        encoder->usr->error(encoder->usr, "invalid lz type %d\n", encoder->type);
e8160e
+    }
e8160e
     encoder->width = decode_32(encoder);
e8160e
     encoder->height = decode_32(encoder);
e8160e
     encoder->stride = decode_32(encoder);