Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37883548
en ru br
ALT Linux repositórios
S:0.15.2-alt1

Group :: Desktop gráfico/Outros
RPM: SPICE

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: 0010-stream-channel-Fix-compiler-warning.patch
Download


From c5412b071a971dd7a93f5b0d01aa801efc31490f Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <freddy77@gmail.com>
Date: Sun, 9 May 2021 06:33:43 +0100
Subject: [PATCH] stream-channel: Fix compiler warning
This removes:
In function ‘stream_channel_get_supported_codecs’,
    inlined from ‘on_connect’ at ../server/stream-channel.cpp:364:60:
../server/stream-channel.cpp:326:31: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  326 |             out_codecs[num++] = codec;
      |                               ^
../server/stream-channel.cpp: In member function ‘on_connect’:
/usr/include/spice-1/spice/stream-device.h:209:13: note: destination object ‘codecs’ of size 0
  209 |     uint8_t codecs[0];
      |             ^
Reported by by Tomasz Kłoczko in
https://gitlab.freedesktop.org/spice/spice/-/issues/44
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
---
 server/stream-channel.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/server/stream-channel.cpp b/server/stream-channel.cpp
index c3e09ca..4d531eb 100644
--- a/server/stream-channel.cpp
+++ b/server/stream-channel.cpp
@@ -351,6 +351,9 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
         StreamMsgStartStop base;
         uint8_t codecs_buffer[MAX_SUPPORTED_CODECS];
     } start_msg;
+    static_assert(offsetof(StreamMsgStartStop, codecs) ==
+                  offsetof(decltype(start_msg), codecs_buffer),
+                  "Wrong assumption");
     StreamMsgStartStop *const start = &start_msg.base;
 
     spice_return_if_fail(stream != nullptr);
@@ -361,7 +364,7 @@ void StreamChannel::on_connect(RedClient *red_client, RedStream *stream,
     }
 
     // request new stream
-    start->num_codecs = stream_channel_get_supported_codecs(this, start->codecs);
+    start->num_codecs = stream_channel_get_supported_codecs(this, start_msg.codecs_buffer);
     // send in any case, even if list is not changed
     // notify device about changes
     request_new_stream(start);
--
libgit2 1.3.0
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009