Skip to content

Commit 7d2118e

Browse files
committed
Merge pull request opencv#14223 from alalek:backport_14201
2 parents df1f62b + ccb89a8 commit 7d2118e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/imgcodecs/src/grfmt_bmp.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ bool BmpDecoder::readData( Mat& img )
203203
int nch = color ? 3 : 1;
204204
int y, width3 = m_width*nch;
205205

206+
// FIXIT: use safe pointer arithmetic (avoid 'int'), use size_t, intptr_t, etc
207+
CV_Assert(((uint64)m_height * m_width * nch < (CV_BIG_UINT(1) << 30)) && "BMP reader implementation doesn't support large images >= 1Gb");
208+
206209
if( m_offset < 0 || !m_strm.isOpened())
207210
return false;
208211

0 commit comments

Comments
 (0)