diff Core/ImageFormats/ImageAccessor.cpp @ 860:80c7e53a69b5 jpeg

bugfix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 07 Jun 2014 10:32:15 +0200
parents a811bdf8b8eb
children a546b05a43da
line wrap: on
line diff
--- a/Core/ImageFormats/ImageAccessor.cpp	Fri Jun 06 18:12:31 2014 +0200
+++ b/Core/ImageFormats/ImageAccessor.cpp	Sat Jun 07 10:32:15 2014 +0200
@@ -36,6 +36,7 @@
 #include "../OrthancException.h"
 
 #include <stdint.h>
+#include <cassert>
 
 namespace Orthanc
 {
@@ -104,6 +105,8 @@
     height_ = height;
     pitch_ = pitch;
     buffer_ = const_cast<void*>(buffer);
+
+    assert(GetBytesPerPixel(format_) * width_ <= pitch_);
   }
 
 
@@ -119,5 +122,7 @@
     height_ = height;
     pitch_ = pitch;
     buffer_ = buffer;
+
+    assert(GetBytesPerPixel(format_) * width_ <= pitch_);
   }
 }