diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-14 12:44:00 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-04-14 12:44:00 +1000 |
| commit | dcbd6b5948017e8763b60bb7e8c434c24a1df74c (patch) | |
| tree | f74f54e1742ba0b1dd9f4020d8a39472ce209403 /src/format/image | |
| parent | d19fb342ca3348b9e4c8a10393238db52f04be2b (diff) | |
feat(png): Validate CRC with crc32.c from tinf
Diffstat (limited to 'src/format/image')
| -rw-r--r-- | src/format/image/png.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c index 1004b2a..8597a55 100644 --- a/src/format/image/png.c +++ b/src/format/image/png.c @@ -66,6 +66,12 @@ static ff_result ff_png_dispatch(ff_ctx* ctx, ff_stream* stream, ff_png_ctx *png png_ctx->last_error = FF_RESULT_ERROR_READ_FILE_FAILURE; return FF_RESULT_ERROR_READ_FILE_FAILURE; } + + uint32_t crc32 = ff_be32(crc); + if (tinf_crc32(chunk_data, length) != crc32) { + png_ctx->last_error = FF_RESULT_ERROR_INVALID_FILE; + return FF_RESULT_ERROR_INVALID_FILE; + } } } |
