[Bugfix] Backported patch from RealVNC 4.1.3. FYI it is not security related.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3183 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx
index 38547c0..cc28846 100644
--- a/common/rfb/CMsgReader.cxx
+++ b/common/rfb/CMsgReader.cxx
@@ -99,6 +99,12 @@
if (encoding == encodingCopyRect) {
readCopyRect(r);
} else {
+
+ if (encoding > encodingMax) {
+ fprintf(stderr, "Unknown rect encoding %d\n", encoding);
+ throw Exception("Unknown rect encoding");
+ }
+
if (!decoders[encoding]) {
decoders[encoding] = Decoder::createDecoder(encoding, this);
if (!decoders[encoding]) {