Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-08-10 16:38:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-08-10 16:38:53 +0400
commit4f1b0e473b874b28fe19fcbb6b1e7b3cde27b11e (patch)
tree31ee191b553239a254e51db7e9e78938b293a4d2
parentbec90b40c3fa84c4c84c3b9e7190cb8ed2e00faf (diff)
add asserts in MemoryBuffer.readNoCheck() so it raises an error when used incorrectly in debug mode.
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h
index f64603ed5d9..142f05af250 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.h
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.h
@@ -29,6 +29,8 @@ class MemoryBuffer;
#include "BLI_rect.h"
#include "COM_MemoryProxy.h"
+#include "MEM_guardedalloc.h"
+
extern "C" {
//#include "BLI_threads.h"
#include "BLI_math.h"
@@ -147,6 +149,18 @@ public:
const int dx = x - this->m_rect.xmin;
const int dy = y - this->m_rect.ymin;
const int offset = (this->m_chunkWidth * dy + dx) * COM_NUMBER_OF_CHANNELS;
+
+ BLI_assert(offset >= 0);
+ BLI_assert(offset < this->determineBufferSize() * COM_NUMBER_OF_CHANNELS);
+ BLI_assert(x >= this->m_rect.xmin && x < this->m_rect.xmax &&
+ y >= this->m_rect.ymin && y < this->m_rect.ymax);
+
+#if 0
+ /* always true */
+ BLI_assert((int)(MEM_allocN_len(this->m_buffer) / sizeof(*this->m_buffer)) ==
+ (int)(this->determineBufferSize() * COM_NUMBER_OF_CHANNELS));
+#endif
+
copy_v4_v4(result, &this->m_buffer[offset]);
}