mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Merge pull request #26734 from asmorkalov:as/png_corrupted
Fixed fread size check for corrupted PNGs
This commit is contained in:
@@ -253,18 +253,12 @@ bool PngDecoder::readHeader()
|
||||
return false;
|
||||
}
|
||||
png_init_io(png_ptr, m_f);
|
||||
|
||||
if (fread(sig, 1, 8, m_f))
|
||||
id = read_chunk(m_chunkIHDR);
|
||||
}
|
||||
|
||||
if (id != id_IHDR)
|
||||
{
|
||||
if (read_from_io(&sig, 8, 1) != 1)
|
||||
return false;
|
||||
id = read_chunk(m_chunkIHDR);
|
||||
}
|
||||
if (read_from_io(&sig, 8, 1) != 1)
|
||||
return false;
|
||||
|
||||
id = read_chunk(m_chunkIHDR);
|
||||
if (!(id == id_IHDR && m_chunkIHDR.p.size() == 25))
|
||||
{
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user