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

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