Skip to content

Commit

Permalink
Merge pull request opencv#26851 from sturkmen72:fix-22551
Browse files Browse the repository at this point in the history
fix related the issue 22551
  • Loading branch information
asmorkalov authored Jan 29, 2025
2 parents bb798d1 + 585226a commit d5f6930
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions modules/imgcodecs/src/grfmt_png.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ const uint32_t id_acTL = 0x4C546361; // Animation control chunk
const uint32_t id_fcTL = 0x4C546366; // Frame control chunk
const uint32_t id_IDAT = 0x54414449; // first frame and/or default image
const uint32_t id_fdAT = 0x54416466; // Frame data chunk
const uint32_t id_PLTE = 0x45544C50;
const uint32_t id_bKGD = 0x44474B62;
const uint32_t id_tRNS = 0x534E5274;
const uint32_t id_PLTE = 0x45544C50; // The PLTE chunk contains a color palette for indexed-color images
const uint32_t id_bKGD = 0x44474B62; // The bKGD chunk specifies a default background color for the image
const uint32_t id_tRNS = 0x534E5274; // The tRNS chunk provides transparency information
const uint32_t id_tEXt = 0x74584574; // The tEXt chunk stores metadata as text in key-value pairs
const uint32_t id_IEND = 0x444E4549; // end/footer chunk

APNGFrame::APNGFrame()
Expand Down Expand Up @@ -725,7 +726,7 @@ uint32_t PngDecoder::read_chunk(Chunk& chunk)
// http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html#C.bKGD
if (size != 8 + 1 + 4 && size != 8 + 2 + 4 && size != 8 + 6 + 4)
return 0;
} else if (id != id_fdAT && id != id_IDAT && id != id_IEND && id != id_PLTE && id != id_tRNS) {
} else if (id != id_fdAT && id != id_IDAT && id != id_IEND && id != id_PLTE && id != id_tEXt && id != id_tRNS) {
if (size > PNG_USER_CHUNK_MALLOC_MAX)
{
CV_LOG_WARNING(NULL, "user chunk data is too large");
Expand Down

0 comments on commit d5f6930

Please sign in to comment.