From f2803aba07c1c522b409cce5390e757f54d7794d Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sun, 31 Mar 2019 12:14:42 +0000 Subject: [PATCH] imgcodecs(sunras): avoid undefined shift oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13292 --- modules/imgcodecs/src/grfmt_sunras.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/imgcodecs/src/grfmt_sunras.cpp b/modules/imgcodecs/src/grfmt_sunras.cpp index a59cc47255..31c0286248 100644 --- a/modules/imgcodecs/src/grfmt_sunras.cpp +++ b/modules/imgcodecs/src/grfmt_sunras.cpp @@ -90,7 +90,7 @@ bool SunRasterDecoder::readHeader() m_width = m_strm.getDWord(); m_height = m_strm.getDWord(); m_bpp = m_strm.getDWord(); - int palSize = 3*(1 << m_bpp); + int palSize = (m_bpp > 0 && m_bpp <= 8) ? (3*(1 << m_bpp)) : 0; m_strm.skip( 4 ); m_encoding = (SunRasType)m_strm.getDWord();