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

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