summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--krdc/vnc/rfbproto.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/krdc/vnc/rfbproto.c b/krdc/vnc/rfbproto.c
index 587e9d1c..82aa9af2 100644
--- a/krdc/vnc/rfbproto.c
+++ b/krdc/vnc/rfbproto.c
@@ -982,7 +982,10 @@ HandleRFBServerMessage()
case rfbEncodingRaw:
bytesPerLine = rect.r.w * myFormat.bitsPerPixel / 8;
- linesToRead = 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 ? (BUFFER_SIZE / bytesPerLine) : 0;
while (rect.r.h > 0) {
if (linesToRead > rect.r.h)