diff options
author | Christian Beier <dontmind@freeshell.org> | 2015-04-17 12:05:39 +0200 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2015-04-17 12:05:39 +0200 |
commit | f5abd4ab20641747b6eb12aac20d7a4786363e02 (patch) | |
tree | b264447c7e51881840f1adb3f8ddf1e607be0530 /libvncclient | |
parent | b7946a6f36cde92f02bcc25f3599fe751482d781 (diff) | |
parent | 79d938c16bf7a14b6d6ee290bcfef3c01f9c4f02 (diff) | |
download | libtdevnc-f5abd4ab20641747b6eb12aac20d7a4786363e02.tar.gz libtdevnc-f5abd4ab20641747b6eb12aac20d7a4786363e02.zip |
Merge pull request #69 from nopdotcom/master
Avoid divide-by-zero in raw encoding (OSX RealVNC)
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 aa74c23..f121072 100644 --- a/libvncclient/rfbproto.c +++ b/libvncclient/rfbproto.c @@ -1946,7 +1946,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) |