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.
pull/8/head
Pierre Ossman 6 years ago committed by Lauri Kasanen
parent 3282836baf
commit 6a3f711878

@ -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

@ -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);
};
};
}

Loading…
Cancel
Save