[Bug 238333] bhyve random crash in rfb.c on FreeBSD current (after r346011)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jun 13 16:01:17 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238333

--- Comment #19 from Mark Johnston <markj at FreeBSD.org> ---
Sorry, it occurred to me that the crash could also arise if we received
multiple encodings messages.  Please try this:

diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c
index d572037b25fe..0a0538f80e53 100644
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -273,8 +273,10 @@ rfb_recv_set_encodings_msg(struct rfb_softc *rc, int cfd)
                        rc->enc_raw_ok = true;
                        break;
                case RFB_ENCODING_ZLIB:
-                       rc->enc_zlib_ok = true;
-                       deflateInit(&rc->zstream, Z_BEST_SPEED);
+                       if (!rc->enc_zlib_ok) {
+                               deflateInit(&rc->zstream, Z_BEST_SPEED);
+                               rc->enc_zlib_ok = true;
+                       }
                        break;
                case RFB_ENCODING_RESIZE:
                        rc->enc_resize_ok = true;

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-virtualization mailing list