[Spice-devel] [spice-server v3 3/8] test-playback: Pass proper types to spice_server_add_interface

Christophe Fergeau cfergeau at redhat.com
Mon Feb 6 17:15:51 UTC 2017


This is a revert of b76e561d.
For a SpicePlaybackInstance, the base interface must be a
SpicePlaybackInterface instance, not a SpiceBaseInterface instance, or
spice-server code will end up reading out of bounds.

Acked-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/test-playback.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/tests/test-playback.c b/server/tests/test-playback.c
index 564d42a..bad11a0 100644
--- a/server/tests/test-playback.c
+++ b/server/tests/test-playback.c
@@ -36,11 +36,11 @@
 
 SpicePlaybackInstance playback_instance;
 
-static const SpiceBaseInterface base = {
-    .type          = SPICE_INTERFACE_PLAYBACK,
-    .description   = "test playback",
-    .major_version = SPICE_INTERFACE_PLAYBACK_MAJOR,
-    .minor_version = SPICE_INTERFACE_PLAYBACK_MINOR,
+static const SpicePlaybackInterface playback_sif = {
+    .base.type          = SPICE_INTERFACE_PLAYBACK,
+    .base.description   = "test playback",
+    .base.major_version = SPICE_INTERFACE_PLAYBACK_MAJOR,
+    .base.minor_version = SPICE_INTERFACE_PLAYBACK_MINOR,
 };
 
 uint32_t *frame;
@@ -112,7 +112,7 @@ int main(void)
     spice_server_set_noauth(server);
     spice_server_init(server, core);
 
-    playback_instance.base.sif = &base;
+    playback_instance.base.sif = &playback_sif.base;
     spice_server_add_interface(server, &playback_instance.base);
     spice_server_playback_start(&playback_instance);
 
-- 
2.9.3



More information about the Spice-devel mailing list