vnc2video
vnc2video copied to clipboard
Crash frequently while connect to UltraVNC.
Error logs as this:
[Info ] ----------RECT 20----------[Debug] rect x: 512, y: 793, width: 1408, height: 46, enc: EncTight
[Trace] -----------READ-Tight-encoding compctl=96 -------------
[Trace] ###resetDecoders compctl :0
[Trace] ----readTightPalette: colorCount=255
[Trace] ----PALETTE_FILTER: paletteSize=0 bytesPixel=3
[Trace] ----PALETTE_FILTER,palette len=0 counter=0, rect= rect x: 512, y: 793, width: 1408, height: 46, enc: EncTight
[Trace] got palette: []
[Trace] >>> Reading zipped tight data from decoder Id: 2, openSize: 64768
[Error] handleTightFilters: error in handling tight encoding, reading palette filter data: flate: corrupt input before offset 347728
[Trace] ----End RECT #20 Info (1408x46) encType:EncTight
[Info ] ----------RECT 21----------[Debug] rect x: 49567, y: 24521, width: 64975, height: 28539, enc: EncodingType(-962466125)
[Trace] ============== End Message: type=0 ==============
The problem was caused by the paletteSize overflow when using uint8 and the value is 255,
using following code can fix it.
code file: "encoding_tight.go":
@@ -532,8 +532,10 @@ func (enc *TightEncoding) readTightPalette(connReader Conn, bytesPixel int) (col
return nil, err
}
- paletteSize := colorCount + 1 // add one more
- //logger.Tracef("----PALETTE_FILTER: paletteSize=%d bytesPixel=%d\n", paletteSize, bytesPixel)
+ logger.Tracef("----readTightPalette: colorCount=%d \n", colorCount)
+
+ paletteSize := int(colorCount) + 1 // add one more
+ logger.Tracef("----PALETTE_FILTER: paletteSize=%d bytesPixel=%d\n", paletteSize, bytesPixel)