[Spice-commits] server/red-replay-qxl.c server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Fri Jan 22 03:06:35 PST 2016


 server/red-replay-qxl.c |    3 +++
 server/tests/replay.c   |    4 ++++
 2 files changed, 7 insertions(+)

New commits:
commit 77ae19c0c67571fd63cb524213a07b9e01030186
Author: Jonathon Jongsma <jjongsma at redhat.com>
Date:   Thu Jan 21 11:25:36 2016 -0600

    Replay: report error if we don't read the correct file header
    
    The replay file should start with a header such as
      SPICE_REPLAY 1
    
    Instead of soldiering on if we don't encounter this header, print a
    warning and return NULL.  Also exit with a failure if spice_replay_new()
    returns a NULL object in main.
    
    Acked-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index 72d06c8..17ee022 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -1209,6 +1209,9 @@ SpiceReplay *spice_replay_new(FILE *file, int nsurfaces)
             spice_warning("Replay file version unsupported");
             return NULL;
         }
+    } else {
+        spice_warning("This doesn't look like a valid replay file");
+        return NULL;
     }
 
     replay = spice_malloc0(sizeof(SpiceReplay));
diff --git a/server/tests/replay.c b/server/tests/replay.c
index 2af9481..0c98168 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -369,6 +369,10 @@ int main(int argc, char **argv)
     if (total_size > 0)
         g_timeout_add_seconds(1, progress_timer, fd);
     replay = spice_replay_new(fd, MAX_SURFACE_NUM);
+    if (replay == NULL) {
+        g_printerr("Error initializing replay\n");
+        exit(1);
+    }
 
     aqueue = g_async_queue_new();
     core = basic_event_loop_init();


More information about the Spice-commits mailing list