diff options
author | Adam Tkac <atkac@redhat.com> | 2010-07-21 14:12:18 +0000 |
---|---|---|
committer | Adam Tkac <atkac@redhat.com> | 2010-07-21 14:12:18 +0000 |
commit | ea633a79bdaf4e1a00df26f5d4cdcf60e39247c1 (patch) | |
tree | a46a605d099ab74974302bfeb8b666e973753809 /common/rfb/Encoder.cxx | |
parent | 214c1a17abb6b148e5156f497f26d267780ffde3 (diff) | |
download | tigervnc-ea633a79bdaf4e1a00df26f5d4cdcf60e39247c1.tar.gz tigervnc-ea633a79bdaf4e1a00df26f5d4cdcf60e39247c1.zip |
[Bugfix] Extend encoding range checks to handle negative encodings well.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4113 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb/Encoder.cxx')
-rw-r--r-- | common/rfb/Encoder.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/rfb/Encoder.cxx b/common/rfb/Encoder.cxx index b0bd147e..5de75430 100644 --- a/common/rfb/Encoder.cxx +++ b/common/rfb/Encoder.cxx @@ -34,12 +34,12 @@ EncoderCreateFnType Encoder::createFns[encodingMax+1] = { 0 }; bool Encoder::supported(int encoding) { - return encoding <= encodingMax && createFns[encoding]; + return encoding >= 0 && encoding <= encodingMax && createFns[encoding]; } Encoder* Encoder::createEncoder(int encoding, SMsgWriter* writer) { - if (encoding <= encodingMax && createFns[encoding]) + if (supported(encoding)) return (*createFns[encoding])(writer); return 0; } |