From c295f06a6f60daf93d9b793dd5f7664ff559b1cf Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Wed, 13 Jul 2022 21:33:06 +0100 Subject: [PATCH] Ensure only props owned by EXIF Object are parsed #3292 --- docs/changelog.md | 3 +++ src/pipeline.cc | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index cfb47c03b..491578eb6 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -30,6 +30,9 @@ Requires libvips v8.13.0 * Ensure `trim` operation is a no-op when it would reduce an image to nothing. [#3223](https://github.com/lovell/sharp/issues/3223) +* Ensure only properties owned by the `withMetadata` EXIF Object are parsed. + [#3292](https://github.com/lovell/sharp/issues/3292) + ## v0.30 - *dresser* Requires libvips v8.12.2 diff --git a/src/pipeline.cc b/src/pipeline.cc index 1a858ff65..5b21cb49d 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -1503,7 +1503,9 @@ Napi::Value pipeline(const Napi::CallbackInfo& info) { Napi::Array mdStrKeys = mdStrs.GetPropertyNames(); for (unsigned int i = 0; i < mdStrKeys.Length(); i++) { std::string k = sharp::AttrAsStr(mdStrKeys, i); - baton->withMetadataStrs.insert(std::make_pair(k, sharp::AttrAsStr(mdStrs, k))); + if (mdStrs.HasOwnProperty(k)) { + baton->withMetadataStrs.insert(std::make_pair(k, sharp::AttrAsStr(mdStrs, k))); + } } baton->timeoutSeconds = sharp::AttrAsUint32(options, "timeoutSeconds"); // Format-specific