mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
imgcodecs(bmp): limit size of processed images
2Gb+ images can't be handled properly by current implementation
backporting of commit: 50a6f9d251
This commit is contained in:
parent
6316b3ed91
commit
ccb89a889a
@ -203,6 +203,9 @@ bool BmpDecoder::readData( Mat& img )
|
||||
int nch = color ? 3 : 1;
|
||||
int y, width3 = m_width*nch;
|
||||
|
||||
// FIXIT: use safe pointer arithmetic (avoid 'int'), use size_t, intptr_t, etc
|
||||
CV_Assert(((uint64)m_height * m_width * nch < (CV_BIG_UINT(1) << 30)) && "BMP reader implementation doesn't support large images >= 1Gb");
|
||||
|
||||
if( m_offset < 0 || !m_strm.isOpened())
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user