File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class EXIV2API PngImage : public Image {
7979 void doWriteMetadata (BasicIo& outIo);
8080 // @}
8181
82- std::string profileName_;
82+ std::string profileName_{ " ICC Profile " } ;
8383
8484}; // class PngImage
8585
Original file line number Diff line number Diff line change @@ -447,13 +447,16 @@ void PngImage::readMetadata() {
447447 enforce (iccOffset < 80 && iccOffset < chunkLength, Exiv2::ErrorCode::kerCorruptedMetadata);
448448 } while (chunkData.read_uint8 (iccOffset++) != 0x00 );
449449
450- profileName_ = std::string (chunkData.c_str (), iccOffset - 1 );
450+ // Don't fail on empty ICC profile name, but also don't overwrite the default
451+ std::string profileName = std::string (chunkData.c_str (), iccOffset - 1 );
452+ if (profileName.size () > 0 )
453+ profileName_ = profileName;
451454 ++iccOffset; // +1 = 'compressed' flag
452455 enforce (iccOffset <= chunkLength, Exiv2::ErrorCode::kerCorruptedMetadata);
453456
454457 zlibToDataBuf (chunkData.c_data (iccOffset), static_cast <uLongf>(chunkLength - iccOffset), iccProfile_);
455458#ifdef EXIV2_DEBUG_MESSAGES
456- std::cout << " Exiv2::PngImage::readMetadata: profile name: " << profileName_ << std::endl;
459+ std::cout << " Exiv2::PngImage::readMetadata: profile name: " << profileName << std::endl;
457460 std::cout << " Exiv2::PngImage::readMetadata: iccProfile.size_ (uncompressed) : " << iccProfile_.size ()
458461 << std::endl;
459462#endif
You can’t perform that action at this time.
0 commit comments