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

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