Skip to content

Commit ad3a475

Browse files
committed
libvncserver/tight: avoid division-by-zero
1 parent 0c9e68a commit ad3a475

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libvncserver/tight.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ rfbNumCodedRectsTight(rfbClientPtr cl,
212212
maxRectSize = tightConf[cl->tightCompressLevel].maxRectSize;
213213
maxRectWidth = tightConf[cl->tightCompressLevel].maxRectWidth;
214214

215-
if (w > maxRectWidth || w * h > maxRectSize) {
215+
if (maxRectWidth > 0 && (w > maxRectWidth || w * h > maxRectSize)) {
216216
subrectMaxWidth = (w > maxRectWidth) ? maxRectWidth : w;
217217
subrectMaxHeight = maxRectSize / subrectMaxWidth;
218218
return (((w - 1) / maxRectWidth + 1) *

0 commit comments

Comments
 (0)