From 851f20e40c2630a09249c25ae3ce95afc69d0337 Mon Sep 17 00:00:00 2001 From: Stefan Cornelius Date: Thu, 25 Jun 2015 00:17:49 +0200 Subject: [PATCH] Fix processing of SunRaster images with negative maplength --- 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 6cbefef3c7..34e5c4e837 100644 --- a/modules/imgcodecs/src/grfmt_sunras.cpp +++ b/modules/imgcodecs/src/grfmt_sunras.cpp @@ -96,7 +96,7 @@ bool SunRasterDecoder::readHeader() (m_encoding == RAS_OLD || m_encoding == RAS_STANDARD || (m_type == RAS_BYTE_ENCODED && m_bpp == 8) || m_type == RAS_FORMAT_RGB) && ((m_maptype == RMT_NONE && m_maplength == 0) || - (m_maptype == RMT_EQUAL_RGB && m_maplength <= palSize && m_bpp <= 8))) + (m_maptype == RMT_EQUAL_RGB && m_maplength <= palSize && m_maplength > 0 && m_bpp <= 8))) { memset( m_palette, 0, sizeof(m_palette));