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.
This commit is contained in:
Pierre Ossman 2019-09-10 15:25:30 +02:00 committed by Lauri Kasanen
parent 3282836baf
commit 6a3f711878
2 changed files with 9 additions and 0 deletions

View File

@ -31,6 +31,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>
@ -1494,6 +1495,11 @@ void EncodeManager::OffsetPixelBuffer::update(const PixelFormat& pf,
stride = 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

View File

@ -187,6 +187,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);
};
};
}