[Spice-devel] [PATCH spice-server v4 1/1] video-stream: prevent crash on stream reattach

Douglas Paul doug at bogon.ca
Sat Mar 9 13:04:33 UTC 2019


I experienced some crashes with qemu 3.1.0 compiled with libspice-server
0.14.0 on Gentoo.

The problem reproduced reliably with a guest running Ubuntu 18.04.2 LTS.
If I connect a viewer at system startup, I would get a crash just after
the fade-in of the login prompt in GDM.

Interestingly, I usually was unable to reproduce the issue if I waited
to connect until after the greeter was fully displayed.

The patch I used to correct the issue for me applies to the master
branch cleanly, so I suspect the problem may still exist.

The only other references to this issue I could find were two abrt
reports in CentOS:
https://bugs.centos.org/view.php?id=15171
https://bugs.centos.org/view.php?id=15441

I'm not sure if the agent->video_encoder is supposed to be guaranteed to
exist when this function is called.

Signed-off-by: Douglas Paul <doug at bogon.ca>
---
 server/video-stream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/server/video-stream.c b/server/video-stream.c
index b624093e..19795098 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -369,7 +369,9 @@ static void before_reattach_stream(DisplayChannel *display,
 #ifdef STREAM_STATS
             agent->stats.num_drops_pipe++;
 #endif
-            agent->video_encoder->notify_server_frame_drop(agent->video_encoder);
+            if (agent->video_encoder) {
+                agent->video_encoder->notify_server_frame_drop(agent->video_encoder);
+            }
         }
     }
 }
-- 
2.19.2



More information about the Spice-devel mailing list