summaryrefslogtreecommitdiff
path: root/src/format/image
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-01 17:05:43 +1100
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-01 17:05:43 +1100
commit52c27fb38fb8a5d989e758eaec8529f8b7acf121 (patch)
tree989350da3f747781ea3036fc9001c00089f4e8bb /src/format/image
parent13f9b8ac3fbcd32302918f8ac6c54d3c95849818 (diff)
refactor(png): Cancel png validation checker if require_valid is off
Diffstat (limited to 'src/format/image')
-rw-r--r--src/format/image/png.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c
index fd9837b..fa0584a 100644
--- a/src/format/image/png.c
+++ b/src/format/image/png.c
@@ -58,11 +58,13 @@ ff_result ff_open_png(ff_stream *stream, ff_png_ctx **out_ctx, ff_flag require_v
ff_dprintf("png: stream read successfully\n");
- ff_result res = ff_png_isvalid(ctx->raw);
- if (res != FF_RESULT_OK) {
- ff_dprintf("png: validation failed (%d)\n", res);
- free(ctx);
- return res;
+ if (require_valid) {
+ ff_result res = ff_png_isvalid(ctx->raw);
+ if (res != FF_RESULT_OK) {
+ ff_dprintf("png: validation failed (%d)\n", res);
+ free(ctx);
+ return res;
+ }
}
ff_dprintf("png: validation passed\n");