Fix paletteSize value overflow when uint8 colorCount value is 255.

This commit is contained in:
F-Sidney
2024-09-02 01:22:55 -03:00
parent 9d50b9dab1
commit 7d38f68540

View File

@@ -11,6 +11,7 @@ import (
"image/draw"
"image/jpeg"
"io"
"github.com/amitbet/vnc2video/logger"
)
@@ -532,7 +533,7 @@ func (enc *TightEncoding) readTightPalette(connReader Conn, bytesPixel int) (col
return nil, err
}
paletteSize := colorCount + 1 // add one more
paletteSize := int(colorCount) + 1 // add one more
//logger.Tracef("----PALETTE_FILTER: paletteSize=%d bytesPixel=%d\n", paletteSize, bytesPixel)
//complete palette
paletteColorBytes, err := ReadBytes(int(paletteSize)*bytesPixel, connReader)