summaryrefslogtreecommitdiffstats
path: root/libvncclient
diff options
context:
space:
mode:
Diffstat (limited to 'libvncclient')
-rw-r--r--libvncclient/rfbproto.c5
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)