Commit f5abd4ab authored by Christian Beier's avatar Christian Beier

Merge pull request #69 from nopdotcom/master

Avoid divide-by-zero in raw encoding (OSX RealVNC)
parents b7946a6f 79d938c1
...@@ -1946,7 +1946,10 @@ HandleRFBServerMessage(rfbClient* client) ...@@ -1946,7 +1946,10 @@ HandleRFBServerMessage(rfbClient* client)
int y=rect.r.y, h=rect.r.h; int y=rect.r.y, h=rect.r.h;
bytesPerLine = rect.r.w * client->format.bitsPerPixel / 8; 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) { while (h > 0) {
if (linesToRead > h) if (linesToRead > h)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment