|
|
12537a |
From 9f615301aba1cc54a749950bf9462c5a85217bc4 Mon Sep 17 00:00:00 2001
|
|
|
12537a |
From: Pierre Ossman <ossman@cendio.se>
|
|
|
12537a |
Date: Tue, 10 Sep 2019 15:25:30 +0200
|
|
|
12537a |
Subject: [PATCH] Add write protection to OffsetPixelBuffer
|
|
|
12537a |
|
|
|
12537a |
No one should every try to write to this buffer. Enforce that by
|
|
|
12537a |
throwing an exception if any one tries to get a writeable pointer
|
|
|
12537a |
to the data.
|
|
|
12537a |
---
|
|
|
12537a |
common/rfb/EncodeManager.cxx | 6 ++++++
|
|
|
12537a |
common/rfb/EncodeManager.h | 3 +++
|
|
|
12537a |
2 files changed, 9 insertions(+)
|
|
|
12537a |
|
|
|
12537a |
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
|
|
|
12537a |
index 1653cea..66ba432 100644
|
|
|
12537a |
--- a/common/rfb/EncodeManager.cxx
|
|
|
12537a |
+++ b/common/rfb/EncodeManager.cxx
|
|
|
12537a |
@@ -24,6 +24,7 @@
|
|
|
12537a |
#include <rfb/SMsgWriter.h>
|
|
|
12537a |
#include <rfb/UpdateTracker.h>
|
|
|
12537a |
#include <rfb/LogWriter.h>
|
|
|
12537a |
+#include <rfb/Exception.h>
|
|
|
12537a |
|
|
|
12537a |
#include <rfb/RawEncoder.h>
|
|
|
12537a |
#include <rfb/RREEncoder.h>
|
|
|
12537a |
@@ -895,6 +896,11 @@ void EncodeManager::OffsetPixelBuffer::update(const PixelFormat& pf,
|
|
|
12537a |
setBuffer(width, height, (rdr::U8*)data_, stride_);
|
|
|
12537a |
}
|
|
|
12537a |
|
|
|
12537a |
+rdr::U8* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& r, int* stride)
|
|
|
12537a |
+{
|
|
|
12537a |
+ throw rfb::Exception("Invalid write attempt to OffsetPixelBuffer");
|
|
|
12537a |
+}
|
|
|
12537a |
+
|
|
|
12537a |
// Preprocessor generated, optimised methods
|
|
|
12537a |
|
|
|
12537a |
#define BPP 8
|
|
|
12537a |
diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h
|
|
|
12537a |
index 79db950..7d47420 100644
|
|
|
12537a |
--- a/common/rfb/EncodeManager.h
|
|
|
12537a |
+++ b/common/rfb/EncodeManager.h
|
|
|
12537a |
@@ -124,6 +124,9 @@ namespace rfb {
|
|
|
12537a |
|
|
|
12537a |
void update(const PixelFormat& pf, int width, int height,
|
|
|
12537a |
const rdr::U8* data_, int stride);
|
|
|
12537a |
+
|
|
|
12537a |
+ private:
|
|
|
12537a |
+ virtual rdr::U8* getBufferRW(const Rect& r, int* stride);
|
|
|
12537a |
};
|
|
|
12537a |
|
|
|
12537a |
OffsetPixelBuffer offsetPixelBuffer;
|