Mercurial > hg > orthanc
diff Core/Images/ImageAccessor.cpp @ 1916:5bcf721bde4f
IImageWriter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Feb 2016 15:26:37 +0100 |
parents | b1291df2f780 |
children | 369897749653 |
line wrap: on
line diff
--- a/Core/Images/ImageAccessor.cpp Tue Feb 09 14:50:29 2016 +0100 +++ b/Core/Images/ImageAccessor.cpp Tue Feb 09 15:26:37 2016 +0100 @@ -176,7 +176,10 @@ pitch_ = pitch; buffer_ = const_cast<void*>(buffer); - assert(GetBytesPerPixel() * width_ <= pitch_); + if (GetBytesPerPixel() * width_ > pitch_) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } } @@ -193,7 +196,10 @@ pitch_ = pitch; buffer_ = buffer; - assert(GetBytesPerPixel() * width_ <= pitch_); + if (GetBytesPerPixel() * width_ > pitch_) + { + throw OrthancException(ErrorCode_ParameterOutOfRange); + } }