Skip to content

Commit c4ec46c

Browse files
committed
imgcodecs(sunras): avoid undefined shift
backporting of commit: f2803ab
1 parent 69ff7a7 commit c4ec46c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/imgcodecs/src/grfmt_sunras.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool SunRasterDecoder::readHeader()
9090
m_width = m_strm.getDWord();
9191
m_height = m_strm.getDWord();
9292
m_bpp = m_strm.getDWord();
93-
int palSize = 3*(1 << m_bpp);
93+
int palSize = (m_bpp > 0 && m_bpp <= 8) ? (3*(1 << m_bpp)) : 0;
9494

9595
m_strm.skip( 4 );
9696
m_encoding = (SunRasType)m_strm.getDWord();

0 commit comments

Comments
 (0)