1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Fixed fread size check for corrupted PNGs.

This commit is contained in:
Alexander Smorkalov
2025-01-08 13:28:28 +03:00
parent 66ffeae4b1
commit 198f23890e
+3 -9
View File
@@ -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;