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 {
79
79
void doWriteMetadata (BasicIo& outIo);
80
80
// @}
81
81
82
- std::string profileName_;
82
+ std::string profileName_{ " ICC Profile " } ;
83
83
84
84
}; // class PngImage
85
85
Original file line number Diff line number Diff line change @@ -447,13 +447,16 @@ void PngImage::readMetadata() {
447
447
enforce (iccOffset < 80 && iccOffset < chunkLength, Exiv2::ErrorCode::kerCorruptedMetadata);
448
448
} while (chunkData.read_uint8 (iccOffset++) != 0x00 );
449
449
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;
451
454
++iccOffset; // +1 = 'compressed' flag
452
455
enforce (iccOffset <= chunkLength, Exiv2::ErrorCode::kerCorruptedMetadata);
453
456
454
457
zlibToDataBuf (chunkData.c_data (iccOffset), static_cast <uLongf>(chunkLength - iccOffset), iccProfile_);
455
458
#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;
457
460
std::cout << " Exiv2::PngImage::readMetadata: iccProfile.size_ (uncompressed) : " << iccProfile_.size ()
458
461
<< std::endl;
459
462
#endif
You can’t perform that action at this time.
0 commit comments