Sfoglia il codice sorgente

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.
tags/v1.10.90
Pierre Ossman 4 anni fa
parent
commit
9f615301ab
2 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 6
    0
      common/rfb/EncodeManager.cxx
  2. 3
    0
      common/rfb/EncodeManager.h

+ 6
- 0
common/rfb/EncodeManager.cxx Vedi File

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

+ 3
- 0
common/rfb/EncodeManager.h Vedi File

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

Loading…
Annulla
Salva