diff options
author | Pierre Ossman <ossman@cendio.se> | 2019-09-10 15:25:30 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2019-12-20 07:29:00 +0100 |
commit | 2473c72ddc5723bcbbcb172bb5a64cddcdf68935 (patch) | |
tree | 9f4b505a680b43269134f2b799451147d2d6f05f | |
parent | ff08ca78b24b5a4ed5263245c7ce8744059ff4ad (diff) | |
download | tigervnc-2473c72ddc5723bcbbcb172bb5a64cddcdf68935.tar.gz tigervnc-2473c72ddc5723bcbbcb172bb5a64cddcdf68935.zip |
Add write protection to OffsetPixelBuffer
No one should every try to write to this buffer. Enforce that by
throwing an exception if any one tries to get a writeable pointer
to the data.
(cherry picked from commit 9f615301aba1cc54a749950bf9462c5a85217bc4)
-rw-r--r-- | common/rfb/EncodeManager.cxx | 6 | ||||
-rw-r--r-- | common/rfb/EncodeManager.h | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 54f7102b..92ac5676 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -28,6 +28,7 @@ #include <rfb/SMsgWriter.h> #include <rfb/UpdateTracker.h> #include <rfb/LogWriter.h> +#include <rfb/Exception.h> #include <rfb/RawEncoder.h> #include <rfb/RREEncoder.h> @@ -1053,6 +1054,11 @@ void EncodeManager::OffsetPixelBuffer::update(const PixelFormat& pf, setBuffer(width, height, (rdr::U8*)data_, stride_); } +rdr::U8* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& r, int* stride) +{ + throw rfb::Exception("Invalid write attempt to OffsetPixelBuffer"); +} + // Preprocessor generated, optimised methods #define BPP 8 diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h index bdae9063..f8201c34 100644 --- a/common/rfb/EncodeManager.h +++ b/common/rfb/EncodeManager.h @@ -148,6 +148,9 @@ namespace rfb { void update(const PixelFormat& pf, int width, int height, const rdr::U8* data_, int stride); + + private: + virtual rdr::U8* getBufferRW(const Rect& r, int* stride); }; OffsetPixelBuffer offsetPixelBuffer; |