Blame SOURCES/0001-quic-Check-we-have-some-data-to-start-decoding-quic-.patch

b95fd1
From d9cc2d4659950df230dfe30e5445b91d4c15604e Mon Sep 17 00:00:00 2001
b95fd1
From: Frediano Ziglio <freddy77@gmail.com>
b95fd1
Date: Wed, 29 Apr 2020 15:09:13 +0100
b95fd1
Subject: [PATCH spice-common 1/4] quic: Check we have some data to start
b95fd1
 decoding quic image
b95fd1
b95fd1
All paths already pass some data to quic_decode_begin but for the
b95fd1
test check it, it's not that expensive test.
b95fd1
Checking for not 0 is enough, all other words will potentially be
b95fd1
read calling more_io_words but we need one to avoid a potential
b95fd1
initial buffer overflow or deferencing an invalid pointer.
b95fd1
b95fd1
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
b95fd1
Acked-by: Uri Lublin <uril@redhat.com>
b95fd1
---
b95fd1
 common/quic.c | 2 +-
b95fd1
 1 file changed, 1 insertion(+), 1 deletion(-)
b95fd1
b95fd1
diff --git a/subprojects/spice-common/common/quic.c b/subprojects/spice-common/common/quic.c
b95fd1
index 55a5d6c..e03f3af 100644
b95fd1
--- a/subprojects/spice-common/common/quic.c
b95fd1
+++ b/subprojects/spice-common/common/quic.c
b95fd1
@@ -1136,7 +1136,7 @@ int quic_decode_begin(QuicContext *quic, uint32_t *io_ptr, unsigned int num_io_w
b95fd1
     int channels;
b95fd1
     int bpc;
b95fd1
 
b95fd1
-    if (!encoder_reset(encoder, io_ptr, io_ptr_end)) {
b95fd1
+    if (!num_io_words || !encoder_reset(encoder, io_ptr, io_ptr_end)) {
b95fd1
         return QUIC_ERROR;
b95fd1
     }
b95fd1
 
b95fd1
-- 
b95fd1
2.25.4
b95fd1