Commit 60ad505a authored by Andrey Kamaev's avatar Andrey Kamaev

Merge pull request #212 from taka-no-me/fix_2602

Prevent imread from illegal memory access (Bug #2602)
parents 2bf56961 1821d21f
......@@ -229,12 +229,16 @@ bool JpegDecoder::readHeader()
if( m_f )
jpeg_stdio_src( &state->cinfo, m_f );
}
jpeg_read_header( &state->cinfo, TRUE );
m_width = state->cinfo.image_width;
m_height = state->cinfo.image_height;
m_type = state->cinfo.num_components > 1 ? CV_8UC3 : CV_8UC1;
result = true;
if (state->cinfo.src != 0)
{
jpeg_read_header( &state->cinfo, TRUE );
m_width = state->cinfo.image_width;
m_height = state->cinfo.image_height;
m_type = state->cinfo.num_components > 1 ? CV_8UC3 : CV_8UC1;
result = true;
}
}
if( !result )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment