Skip to content

Commit 3719ee8

Browse files
authored
Merge branch 'LibVNC:master' into fix/http-shutdown-without-httpdir
2 parents 1569951 + 540332b commit 3719ee8

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/libvncclient/tight.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,16 @@ HandleTightBPP (rfbClient* client, int rx, int ry, int rw, int rh)
341341

342342
numRows = (bufferSize - zs->avail_out) / rowSize;
343343

344+
/* The decompressed stream is server-controlled and may yield more rows
345+
than the rectangle's declared height. filterFn() writes directly into
346+
client->frameBuffer, so clamp here before writing to avoid running past
347+
the framebuffer (heap out-of-bounds write). The post-loop
348+
"rowsProcessed != rh" check happens too late. */
349+
if (numRows > rh - rowsProcessed) {
350+
rfbClientLog("Tight: too many scan lines after decompression.\n");
351+
return FALSE;
352+
}
353+
344354
filterFn(client, rx, ry+rowsProcessed, numRows);
345355

346356
extraBytes = bufferSize - zs->avail_out - numRows * rowSize;

src/libvncserver/rfbserver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3976,7 +3976,7 @@ rfbSendExtDesktopSize(rfbClientPtr cl,
39763976
rfbBool
39773977
rfbSendUpdateBuf(rfbClientPtr cl)
39783978
{
3979-
if(cl->sock<0)
3979+
if(cl->sock<0 || cl->state == RFB_SHUTDOWN)
39803980
return FALSE;
39813981

39823982
if (rfbWriteExact(cl, cl->updateBuf, cl->ublen) < 0) {

0 commit comments

Comments
 (0)