comparison OrthancFramework/Sources/Images/ImageBuffer.cpp @ 5838:4b47151dea4c

fix crashes if handling very large images
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 16 Oct 2024 18:27:31 +0200
parents f7adfb22e20e
children
comparison
equal deleted inserted replaced
5821:37e5d0918006 5838:4b47151dea4c
45 TODO: Align pitch and memory buffer to optimal size for SIMD. 45 TODO: Align pitch and memory buffer to optimal size for SIMD.
46 } 46 }
47 */ 47 */
48 48
49 pitch_ = GetBytesPerPixel() * width_; 49 pitch_ = GetBytesPerPixel() * width_;
50 size_t size = pitch_ * height_; 50 size_t size = static_cast<size_t>(pitch_) * static_cast<size_t>(height_);
51 51
52 if (size == 0) 52 if (size == 0)
53 { 53 {
54 buffer_ = NULL; 54 buffer_ = NULL;
55 } 55 }