diff options
author | Jay Carlson <[email protected]> | 2015-03-27 11:22:13 -0400 |
---|---|---|
committer | Jay Carlson <[email protected]> | 2015-03-27 11:22:13 -0400 |
commit | 79d938c16bf7a14b6d6ee290bcfef3c01f9c4f02 (patch) | |
tree | 911fdad5eb67a4206b225590b65cefca94e77b34 /libvncclient | |
parent | 53becab94cccbcab9b20efd24b6071c2f3557eff (diff) | |
download | libtdevnc-79d938c16bf7a14b6d6ee290bcfef3c01f9c4f02.tar.gz libtdevnc-79d938c16bf7a14b6d6ee290bcfef3c01f9c4f02.zip |
Avoid divide-by-zero in raw encoding (OSX RealVNC)
OS X RealVNC server crashes out Remmina because the server can provoke
bytesPerLine to be zero. Assume this is coding for zero lines.
The condition could be checked before the calculation of bytesPerLine.
I don’t understand the preconditions of this code to say one way or the
other.
Diffstat (limited to 'libvncclient')
-rw-r--r-- | libvncclient/rfbproto.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libvncclient/rfbproto.c b/libvncclient/rfbproto.c index f653850..d01013f 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -1936,7 +1936,10 @@ HandleRFBServerMessage(rfbClient* client) int y=rect.r.y, h=rect.r.h; bytesPerLine = rect.r.w * client->format.bitsPerPixel / 8; - linesToRead = RFB_BUFFER_SIZE / bytesPerLine; + /* RealVNC 4.x-5.x on OSX can induce bytesPerLine==0, + usually during GPU accel. */ + /* Regardless of cause, do not divide by zero. */ + linesToRead = bytesPerLine ? (RFB_BUFFER_SIZE / bytesPerLine) : 0; while (h > 0) { if (linesToRead > h) |