aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/PixelFormat.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2019-10-02 16:06:08 +0200
committerPierre Ossman <ossman@cendio.se>2019-11-15 12:26:25 +0100
commit05e28490873a861379c943bf616614b78b558b89 (patch)
tree91ba8a69622340b19a849c87b7fdd68cf7492cf9 /common/rfb/PixelFormat.cxx
parent91bdaa6c87a7f311163b5f1e4bbcd9de584968cd (diff)
downloadtigervnc-05e28490873a861379c943bf616614b78b558b89.tar.gz
tigervnc-05e28490873a861379c943bf616614b78b558b89.zip
Handle pixel formats with odd shift values
Our fast paths assume that each channel fits in to a separate byte. That means the shift needs to be a multiple of 8. Start actually checking this so that a client cannot trip us up and possibly cause incorrect code exection. Issue found by Pavel Cheremushkin from Kaspersky Lab.
Diffstat (limited to 'common/rfb/PixelFormat.cxx')
-rw-r--r--common/rfb/PixelFormat.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/rfb/PixelFormat.cxx b/common/rfb/PixelFormat.cxx
index 789c43ed..1b4ab1ba 100644
--- a/common/rfb/PixelFormat.cxx
+++ b/common/rfb/PixelFormat.cxx
@@ -206,6 +206,12 @@ bool PixelFormat::is888(void) const
return false;
if (blueMax != 255)
return false;
+ if ((redShift & 0x7) != 0)
+ return false;
+ if ((greenShift & 0x7) != 0)
+ return false;
+ if ((blueShift & 0x7) != 0)
+ return false;
return true;
}