idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
12,800 | static void ExportTIFF_PhotographicSensitivity ( SXMPMeta * xmp, TIFF_Manager * exif ) {
try {
bool foundXMP, foundExif;
TIFF_Manager::TagInfo tagInfo;
std::string xmpValue;
XMP_OptionBits flags;
XMP_Int32 binValue = 0;
bool haveOldExif = true; // Default to old Exif if no version tag.
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ExifVersion, &tagInfo );
if ( foundExif && (tagInfo.type == kTIFF_UndefinedType) && (tagInfo.count == 4) ) {
haveOldExif = (strncmp ( (char*)tagInfo.dataPtr, "0230", 4 ) < 0);
}
if ( haveOldExif ) { // Exif version is before 2.3, use just the old tag and property.
foundXMP = xmp->GetProperty ( kXMP_NS_EXIF, "ISOSpeedRatings", 0, &flags );
if ( foundXMP && XMP_PropIsArray(flags) && (xmp->CountArrayItems ( kXMP_NS_EXIF, "ISOSpeedRatings" ) > 0) ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", &binValue, 0 );
}
if ( ! foundXMP ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", &binValue, 0 );
}
if ( foundXMP && (0 <= binValue) && (binValue <= 65535) ) {
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" ); // So namespace cleanup won't keep it.
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, &tagInfo );
if ( ! foundExif ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, (XMP_Uns16)binValue );
}
}
} else { // Exif version is 2.3 or newer, use the Exif 2.3 tags and properties.
if ( ! xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "PhotographicSensitivity" ) ) {
foundXMP = xmp->GetProperty ( kXMP_NS_EXIF, "ISOSpeedRatings", 0, &flags );
if ( foundXMP && XMP_PropIsArray(flags) &&
(xmp->CountArrayItems ( kXMP_NS_EXIF, "ISOSpeedRatings" ) > 0) ) {
xmp->GetArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", 1, &xmpValue, 0 );
xmp->SetProperty ( kXMP_NS_ExifEX, "PhotographicSensitivity", xmpValue.c_str() );
}
}
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" ); // Don't want it kept after namespace cleanup.
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", &binValue, 0 );
if ( foundXMP && (0 <= binValue) && (binValue <= 65535) ) { // The simpler low ISO case.
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, &tagInfo );
if ( ! foundExif ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, (XMP_Uns16)binValue );
}
} else if ( foundXMP ) { // The more commplex high ISO case.
bool havePhotographicSensitivityTag = exif->GetTag ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, 0 );
bool haveSensitivityTypeTag = exif->GetTag ( kTIFF_ExifIFD, kTIFF_SensitivityType, 0 );
bool haveISOSpeedTag = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeed, 0 );
bool haveSensitivityTypeXMP = xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "SensitivityType" );
bool haveISOSpeedXMP = xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "ISOSpeed" );
if ( (! havePhotographicSensitivityTag) && (! haveSensitivityTypeTag) && (! haveISOSpeedTag) ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, 65535 );
if ( (! haveSensitivityTypeXMP) && (! haveISOSpeedXMP) ) {
xmp->SetProperty ( kXMP_NS_ExifEX, "SensitivityType", "3" );
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeed", binValue );
}
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_SensitivityType, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "SensitivityType", &binValue, 0 );
if ( foundXMP && (0 <= binValue) && (binValue <= 65535) ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_SensitivityType, (XMP_Uns16)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_StandardOutputSensitivity, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "StandardOutputSensitivity", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_StandardOutputSensitivity, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_RecommendedExposureIndex, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "RecommendedExposureIndex", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_RecommendedExposureIndex, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeed, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeed", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_ISOSpeed, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudeyyy, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeedLatitudeyyy", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudeyyy, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudezzz, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeedLatitudezzz", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudezzz, (XMP_Uns32)binValue );
}
}
}
} catch ( ... ) {
}
} // ExportTIFF_PhotographicSensitivity
| DoS | 0 | static void ExportTIFF_PhotographicSensitivity ( SXMPMeta * xmp, TIFF_Manager * exif ) {
try {
bool foundXMP, foundExif;
TIFF_Manager::TagInfo tagInfo;
std::string xmpValue;
XMP_OptionBits flags;
XMP_Int32 binValue = 0;
bool haveOldExif = true; // Default to old Exif if no version tag.
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ExifVersion, &tagInfo );
if ( foundExif && (tagInfo.type == kTIFF_UndefinedType) && (tagInfo.count == 4) ) {
haveOldExif = (strncmp ( (char*)tagInfo.dataPtr, "0230", 4 ) < 0);
}
if ( haveOldExif ) { // Exif version is before 2.3, use just the old tag and property.
foundXMP = xmp->GetProperty ( kXMP_NS_EXIF, "ISOSpeedRatings", 0, &flags );
if ( foundXMP && XMP_PropIsArray(flags) && (xmp->CountArrayItems ( kXMP_NS_EXIF, "ISOSpeedRatings" ) > 0) ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", &binValue, 0 );
}
if ( ! foundXMP ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", &binValue, 0 );
}
if ( foundXMP && (0 <= binValue) && (binValue <= 65535) ) {
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" ); // So namespace cleanup won't keep it.
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, &tagInfo );
if ( ! foundExif ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, (XMP_Uns16)binValue );
}
}
} else { // Exif version is 2.3 or newer, use the Exif 2.3 tags and properties.
if ( ! xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "PhotographicSensitivity" ) ) {
foundXMP = xmp->GetProperty ( kXMP_NS_EXIF, "ISOSpeedRatings", 0, &flags );
if ( foundXMP && XMP_PropIsArray(flags) &&
(xmp->CountArrayItems ( kXMP_NS_EXIF, "ISOSpeedRatings" ) > 0) ) {
xmp->GetArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", 1, &xmpValue, 0 );
xmp->SetProperty ( kXMP_NS_ExifEX, "PhotographicSensitivity", xmpValue.c_str() );
}
}
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" ); // Don't want it kept after namespace cleanup.
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", &binValue, 0 );
if ( foundXMP && (0 <= binValue) && (binValue <= 65535) ) { // The simpler low ISO case.
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, &tagInfo );
if ( ! foundExif ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, (XMP_Uns16)binValue );
}
} else if ( foundXMP ) { // The more commplex high ISO case.
bool havePhotographicSensitivityTag = exif->GetTag ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, 0 );
bool haveSensitivityTypeTag = exif->GetTag ( kTIFF_ExifIFD, kTIFF_SensitivityType, 0 );
bool haveISOSpeedTag = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeed, 0 );
bool haveSensitivityTypeXMP = xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "SensitivityType" );
bool haveISOSpeedXMP = xmp->DoesPropertyExist ( kXMP_NS_ExifEX, "ISOSpeed" );
if ( (! havePhotographicSensitivityTag) && (! haveSensitivityTypeTag) && (! haveISOSpeedTag) ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, 65535 );
if ( (! haveSensitivityTypeXMP) && (! haveISOSpeedXMP) ) {
xmp->SetProperty ( kXMP_NS_ExifEX, "SensitivityType", "3" );
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeed", binValue );
}
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_SensitivityType, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "SensitivityType", &binValue, 0 );
if ( foundXMP && (0 <= binValue) && (binValue <= 65535) ) {
exif->SetTag_Short ( kTIFF_ExifIFD, kTIFF_SensitivityType, (XMP_Uns16)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_StandardOutputSensitivity, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "StandardOutputSensitivity", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_StandardOutputSensitivity, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_RecommendedExposureIndex, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "RecommendedExposureIndex", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_RecommendedExposureIndex, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeed, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeed", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_ISOSpeed, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudeyyy, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeedLatitudeyyy", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudeyyy, (XMP_Uns32)binValue );
}
}
foundExif = exif->GetTag ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudezzz, &tagInfo );
if ( ! foundExif ) {
foundXMP = xmp->GetProperty_Int ( kXMP_NS_ExifEX, "ISOSpeedLatitudezzz", &binValue, 0 );
if ( foundXMP && (binValue >= 0) ) {
exif->SetTag_Long ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudezzz, (XMP_Uns32)binValue );
}
}
}
} catch ( ... ) {
}
} // ExportTIFF_PhotographicSensitivity
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,801 | ExportTIFF_StandardMappings ( XMP_Uns8 ifd, TIFF_Manager * tiff, const SXMPMeta & xmp )
{
const bool nativeEndian = tiff->IsNativeEndian();
TIFF_Manager::TagInfo tagInfo;
std::string xmpValue;
XMP_OptionBits xmpForm;
const TIFF_MappingToXMP * mappings = 0;
if ( ifd == kTIFF_PrimaryIFD ) {
mappings = sPrimaryIFDMappings;
} else if ( ifd == kTIFF_ExifIFD ) {
mappings = sExifIFDMappings;
} else if ( ifd == kTIFF_GPSInfoIFD ) {
mappings = sGPSInfoIFDMappings;
} else {
XMP_Throw ( "Invalid IFD for standard mappings", kXMPErr_InternalFailure );
}
for ( size_t i = 0; mappings[i].id != 0xFFFF; ++i ) {
try { // Don't let errors with one stop the others.
const TIFF_MappingToXMP & mapInfo = mappings[i];
if ( mapInfo.exportMode == kExport_Never ) continue;
if ( mapInfo.name[0] == 0 ) continue; // Skip special mappings, handled higher up.
bool haveTIFF = tiff->GetTag ( ifd, mapInfo.id, &tagInfo );
if ( haveTIFF && (mapInfo.exportMode == kExport_InjectOnly) ) continue;
bool haveXMP = xmp.GetProperty ( mapInfo.ns, mapInfo.name, &xmpValue, &xmpForm );
if ( ! haveXMP ) {
if ( haveTIFF && (mapInfo.exportMode == kExport_Always) ) tiff->DeleteTag ( ifd, mapInfo.id );
} else {
XMP_Assert ( tagInfo.type != kTIFF_UndefinedType ); // These must have a special mapping.
if ( tagInfo.type == kTIFF_UndefinedType ) continue;
const bool mapSingle = ((mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType));
if ( mapSingle ) {
if ( ! XMP_PropIsSimple ( xmpForm ) ) continue; // ? Notify client?
ExportSingleTIFF ( tiff, ifd, mapInfo, nativeEndian, xmpValue );
} else {
if ( ! XMP_PropIsArray ( xmpForm ) ) continue; // ? Notify client?
ExportArrayTIFF ( tiff, ifd, mapInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name );
}
}
} catch ( ... ) {
}
}
} // ExportTIFF_StandardMappings
| DoS | 0 | ExportTIFF_StandardMappings ( XMP_Uns8 ifd, TIFF_Manager * tiff, const SXMPMeta & xmp )
{
const bool nativeEndian = tiff->IsNativeEndian();
TIFF_Manager::TagInfo tagInfo;
std::string xmpValue;
XMP_OptionBits xmpForm;
const TIFF_MappingToXMP * mappings = 0;
if ( ifd == kTIFF_PrimaryIFD ) {
mappings = sPrimaryIFDMappings;
} else if ( ifd == kTIFF_ExifIFD ) {
mappings = sExifIFDMappings;
} else if ( ifd == kTIFF_GPSInfoIFD ) {
mappings = sGPSInfoIFDMappings;
} else {
XMP_Throw ( "Invalid IFD for standard mappings", kXMPErr_InternalFailure );
}
for ( size_t i = 0; mappings[i].id != 0xFFFF; ++i ) {
try { // Don't let errors with one stop the others.
const TIFF_MappingToXMP & mapInfo = mappings[i];
if ( mapInfo.exportMode == kExport_Never ) continue;
if ( mapInfo.name[0] == 0 ) continue; // Skip special mappings, handled higher up.
bool haveTIFF = tiff->GetTag ( ifd, mapInfo.id, &tagInfo );
if ( haveTIFF && (mapInfo.exportMode == kExport_InjectOnly) ) continue;
bool haveXMP = xmp.GetProperty ( mapInfo.ns, mapInfo.name, &xmpValue, &xmpForm );
if ( ! haveXMP ) {
if ( haveTIFF && (mapInfo.exportMode == kExport_Always) ) tiff->DeleteTag ( ifd, mapInfo.id );
} else {
XMP_Assert ( tagInfo.type != kTIFF_UndefinedType ); // These must have a special mapping.
if ( tagInfo.type == kTIFF_UndefinedType ) continue;
const bool mapSingle = ((mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType));
if ( mapSingle ) {
if ( ! XMP_PropIsSimple ( xmpForm ) ) continue; // ? Notify client?
ExportSingleTIFF ( tiff, ifd, mapInfo, nativeEndian, xmpValue );
} else {
if ( ! XMP_PropIsArray ( xmpForm ) ) continue; // ? Notify client?
ExportArrayTIFF ( tiff, ifd, mapInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name );
}
}
} catch ( ... ) {
}
}
} // ExportTIFF_StandardMappings
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,802 | static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
{
XMP_Uns32 value = 0;
const char * strEnd = strPtr + count;
while ( strPtr < strEnd ) {
char ch = *strPtr;
if ( (ch < '0') || (ch > '9') ) break;
value = value*10 + (ch - '0');
++strPtr;
}
return value;
} // GatherInt
| DoS | 0 | static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
{
XMP_Uns32 value = 0;
const char * strEnd = strPtr + count;
while ( strPtr < strEnd ) {
char ch = *strPtr;
if ( (ch < '0') || (ch > '9') ) break;
value = value*10 + (ch - '0');
++strPtr;
}
return value;
} // GatherInt
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,803 | static void Import3WayDateTime ( XMP_Uns16 exifTag, const TIFF_Manager & exif, const IPTC_Manager & iptc,
SXMPMeta * xmp, int iptcDigestState, const IPTC_Manager & oldIPTC )
{
XMP_Uns8 iptcDS;
XMP_StringPtr xmpNS, xmpProp;
if ( exifTag == kTIFF_DateTimeOriginal ) {
iptcDS = kIPTC_DateCreated;
xmpNS = kXMP_NS_Photoshop;
xmpProp = "DateCreated";
} else if ( exifTag == kTIFF_DateTimeDigitized ) {
iptcDS = kIPTC_DigitalCreateDate;
xmpNS = kXMP_NS_XMP;
xmpProp = "CreateDate";
} else {
XMP_Throw ( "Unrecognized dateID", kXMPErr_BadParam );
}
size_t iptcCount;
bool haveXMP, haveExif, haveIPTC; // ! These are manipulated to simplify MWG-compliant logic.
std::string xmpValue, exifValue, iptcValue;
TIFF_Manager::TagInfo exifInfo;
IPTC_Manager::DataSetInfo iptcInfo;
haveXMP = xmp->GetProperty ( xmpNS, xmpProp, &xmpValue, 0 );
iptcCount = PhotoDataUtils::GetNativeInfo ( iptc, iptcDS, iptcDigestState, haveXMP, &iptcInfo );
haveIPTC = (iptcCount > 0);
XMP_Assert ( (iptcDigestState == kDigestMatches) ? (! haveIPTC) : true );
haveExif = (! haveXMP) && (! haveIPTC) && PhotoDataUtils::GetNativeInfo ( exif, kTIFF_ExifIFD, exifTag, &exifInfo );
XMP_Assert ( (! (haveExif & haveXMP)) & (! (haveExif & haveIPTC)) );
if ( haveIPTC ) {
PhotoDataUtils::ImportIPTC_Date ( iptcDS, iptc, xmp );
} else if ( haveExif && (exifInfo.type == kTIFF_ASCIIType) ) {
TIFF_FileWriter exifFromXMP;
TIFF_Manager::TagInfo infoFromXMP;
ExportTIFF_Date ( *xmp, xmpNS, xmpProp, &exifFromXMP, exifTag );
bool foundFromXMP = exifFromXMP.GetTag ( kTIFF_ExifIFD, exifTag, &infoFromXMP );
if ( (! foundFromXMP) || (exifInfo.dataLen != infoFromXMP.dataLen) ||
(! XMP_LitNMatch ( (char*)exifInfo.dataPtr, (char*)infoFromXMP.dataPtr, exifInfo.dataLen )) ) {
ImportTIFF_Date ( exif, exifInfo, xmp, xmpNS, xmpProp );
}
}
} // Import3WayDateTime
| DoS | 0 | static void Import3WayDateTime ( XMP_Uns16 exifTag, const TIFF_Manager & exif, const IPTC_Manager & iptc,
SXMPMeta * xmp, int iptcDigestState, const IPTC_Manager & oldIPTC )
{
XMP_Uns8 iptcDS;
XMP_StringPtr xmpNS, xmpProp;
if ( exifTag == kTIFF_DateTimeOriginal ) {
iptcDS = kIPTC_DateCreated;
xmpNS = kXMP_NS_Photoshop;
xmpProp = "DateCreated";
} else if ( exifTag == kTIFF_DateTimeDigitized ) {
iptcDS = kIPTC_DigitalCreateDate;
xmpNS = kXMP_NS_XMP;
xmpProp = "CreateDate";
} else {
XMP_Throw ( "Unrecognized dateID", kXMPErr_BadParam );
}
size_t iptcCount;
bool haveXMP, haveExif, haveIPTC; // ! These are manipulated to simplify MWG-compliant logic.
std::string xmpValue, exifValue, iptcValue;
TIFF_Manager::TagInfo exifInfo;
IPTC_Manager::DataSetInfo iptcInfo;
haveXMP = xmp->GetProperty ( xmpNS, xmpProp, &xmpValue, 0 );
iptcCount = PhotoDataUtils::GetNativeInfo ( iptc, iptcDS, iptcDigestState, haveXMP, &iptcInfo );
haveIPTC = (iptcCount > 0);
XMP_Assert ( (iptcDigestState == kDigestMatches) ? (! haveIPTC) : true );
haveExif = (! haveXMP) && (! haveIPTC) && PhotoDataUtils::GetNativeInfo ( exif, kTIFF_ExifIFD, exifTag, &exifInfo );
XMP_Assert ( (! (haveExif & haveXMP)) & (! (haveExif & haveIPTC)) );
if ( haveIPTC ) {
PhotoDataUtils::ImportIPTC_Date ( iptcDS, iptc, xmp );
} else if ( haveExif && (exifInfo.type == kTIFF_ASCIIType) ) {
TIFF_FileWriter exifFromXMP;
TIFF_Manager::TagInfo infoFromXMP;
ExportTIFF_Date ( *xmp, xmpNS, xmpProp, &exifFromXMP, exifTag );
bool foundFromXMP = exifFromXMP.GetTag ( kTIFF_ExifIFD, exifTag, &infoFromXMP );
if ( (! foundFromXMP) || (exifInfo.dataLen != infoFromXMP.dataLen) ||
(! XMP_LitNMatch ( (char*)exifInfo.dataPtr, (char*)infoFromXMP.dataPtr, exifInfo.dataLen )) ) {
ImportTIFF_Date ( exif, exifInfo, xmp, xmpNS, xmpProp );
}
}
} // Import3WayDateTime
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,804 | ImportArrayTIFF ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
switch ( tagInfo.type ) {
case kTIFF_ShortType :
ImportArrayTIFF_Short ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_LongType :
ImportArrayTIFF_Long ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_RationalType :
ImportArrayTIFF_Rational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SRationalType :
ImportArrayTIFF_SRational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_ASCIIType :
ImportArrayTIFF_ASCII ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_ByteType :
ImportArrayTIFF_Byte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SByteType :
ImportArrayTIFF_SByte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SShortType :
ImportArrayTIFF_SShort ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SLongType :
ImportArrayTIFF_SLong ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_FloatType :
ImportArrayTIFF_Float ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_DoubleType :
ImportArrayTIFF_Double ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
}
} // ImportArrayTIFF
| DoS | 0 | ImportArrayTIFF ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
switch ( tagInfo.type ) {
case kTIFF_ShortType :
ImportArrayTIFF_Short ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_LongType :
ImportArrayTIFF_Long ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_RationalType :
ImportArrayTIFF_Rational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SRationalType :
ImportArrayTIFF_SRational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_ASCIIType :
ImportArrayTIFF_ASCII ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_ByteType :
ImportArrayTIFF_Byte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SByteType :
ImportArrayTIFF_SByte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SShortType :
ImportArrayTIFF_SShort ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SLongType :
ImportArrayTIFF_SLong ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_FloatType :
ImportArrayTIFF_Float ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_DoubleType :
ImportArrayTIFF_Double ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
}
} // ImportArrayTIFF
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,805 | ImportArrayTIFF_Byte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns8 * binPtr = (XMP_Uns8*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Uns8 binValue = *binPtr;
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", (XMP_Uns16)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Byte
| DoS | 0 | ImportArrayTIFF_Byte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns8 * binPtr = (XMP_Uns8*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Uns8 binValue = *binPtr;
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", (XMP_Uns16)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Byte
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,806 | ImportArrayTIFF_Double ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
double * binPtr = (double*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
double binValue = *binPtr;
if ( ! nativeEndian ) Flip8 ( &binValue );
std::string strValue;
SXMPUtils::ConvertFromFloat ( binValue, "", &strValue ); // ! Yes, ConvertFromFloat.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue.c_str() );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Double
| DoS | 0 | ImportArrayTIFF_Double ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
double * binPtr = (double*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
double binValue = *binPtr;
if ( ! nativeEndian ) Flip8 ( &binValue );
std::string strValue;
SXMPUtils::ConvertFromFloat ( binValue, "", &strValue ); // ! Yes, ConvertFromFloat.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue.c_str() );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Double
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,807 | ImportArrayTIFF_Long ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Uns32 binValue = *binPtr;
if ( ! nativeEndian ) binValue = Flip4 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%lu", (unsigned long)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Long
| DoS | 0 | ImportArrayTIFF_Long ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Uns32 binValue = *binPtr;
if ( ! nativeEndian ) binValue = Flip4 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%lu", (unsigned long)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Long
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,808 | ImportArrayTIFF_Rational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, binPtr += 2 ) {
XMP_Uns32 binNum = GetUns32AsIs ( &binPtr[0] );
XMP_Uns32 binDenom = GetUns32AsIs ( &binPtr[1] );
if ( ! nativeEndian ) {
binNum = Flip4 ( binNum );
binDenom = Flip4 ( binDenom );
}
char strValue[40];
snprintf ( strValue, sizeof(strValue), "%lu/%lu", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Rational
| DoS | 0 | ImportArrayTIFF_Rational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, binPtr += 2 ) {
XMP_Uns32 binNum = GetUns32AsIs ( &binPtr[0] );
XMP_Uns32 binDenom = GetUns32AsIs ( &binPtr[1] );
if ( ! nativeEndian ) {
binNum = Flip4 ( binNum );
binDenom = Flip4 ( binDenom );
}
char strValue[40];
snprintf ( strValue, sizeof(strValue), "%lu/%lu", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Rational
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,809 | ImportArrayTIFF_SByte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int8 * binPtr = (XMP_Int8*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Int8 binValue = *binPtr;
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", (short)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_SByte
| DoS | 0 | ImportArrayTIFF_SByte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int8 * binPtr = (XMP_Int8*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Int8 binValue = *binPtr;
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", (short)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_SByte
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,810 | ImportArrayTIFF_SRational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int32 * binPtr = (XMP_Int32*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, binPtr += 2 ) {
XMP_Int32 binNum = binPtr[0];
XMP_Int32 binDenom = binPtr[1];
if ( ! nativeEndian ) {
Flip4 ( &binNum );
Flip4 ( &binDenom );
}
char strValue[40];
snprintf ( strValue, sizeof(strValue), "%ld/%ld", (long)binNum, (long)binDenom ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_SRational
| DoS | 0 | ImportArrayTIFF_SRational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int32 * binPtr = (XMP_Int32*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, binPtr += 2 ) {
XMP_Int32 binNum = binPtr[0];
XMP_Int32 binDenom = binPtr[1];
if ( ! nativeEndian ) {
Flip4 ( &binNum );
Flip4 ( &binDenom );
}
char strValue[40];
snprintf ( strValue, sizeof(strValue), "%ld/%ld", (long)binNum, (long)binDenom ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_SRational
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,811 | ImportArrayTIFF_SShort ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int16 * binPtr = (XMP_Int16*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Int16 binValue = *binPtr;
if ( ! nativeEndian ) Flip2 ( &binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_SShort
| DoS | 0 | ImportArrayTIFF_SShort ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int16 * binPtr = (XMP_Int16*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Int16 binValue = *binPtr;
if ( ! nativeEndian ) Flip2 ( &binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_SShort
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,812 | ImportArrayTIFF_Short ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns16 * binPtr = (XMP_Uns16*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Uns16 binValue = *binPtr;
if ( ! nativeEndian ) binValue = Flip2 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Short
| DoS | 0 | ImportArrayTIFF_Short ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns16 * binPtr = (XMP_Uns16*)tagInfo.dataPtr;
xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array.
for ( size_t i = 0; i < tagInfo.count; ++i, ++binPtr ) {
XMP_Uns16 binValue = *binPtr;
if ( ! nativeEndian ) binValue = Flip2 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue );
}
} catch ( ... ) {
}
} // ImportArrayTIFF_Short
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,813 | ImportConversionTable ( const TIFF_Manager::TagInfo & tagInfo, bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
const bool isSigned = (tagInfo.id == kTIFF_OECF);
XMP_Assert ( (tagInfo.id == kTIFF_OECF) || (tagInfo.id == kTIFF_SpatialFrequencyResponse) );
xmp->DeleteProperty ( xmpNS, xmpProp );
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! nativeEndian ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[40];
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
std::string arrayPath;
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Names", &arrayPath );
bytePtr += 4; // Move to the list of names. Don't convert from local text, should really be ASCII.
for ( size_t i = columns; i > 0; --i ) {
size_t nameLen = strlen((XMP_StringPtr)bytePtr) + 1; // ! Include the terminating nul.
if ( (bytePtr + nameLen) > byteEnd ) XMP_Throw ( "OECF-SFR name overflow", kXMPErr_BadValue );
if ( ! ReconcileUtils::IsUTF8 ( bytePtr, nameLen ) ) XMP_Throw ( "OECF-SFR name error", kXMPErr_BadValue );
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, (XMP_StringPtr)bytePtr );
bytePtr += nameLen;
}
if ( (byteEnd - bytePtr) != (8 * columns * rows) ) XMP_Throw ( "OECF-SFR data overflow", kXMPErr_BadValue );
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Values", &arrayPath );
XMP_Uns32 * binPtr = (XMP_Uns32*)bytePtr;
for ( size_t i = (columns * rows); i > 0; --i, binPtr += 2 ) {
XMP_Uns32 binNum = binPtr[0];
XMP_Uns32 binDenom = binPtr[1];
if ( ! nativeEndian ) {
Flip4 ( &binNum );
Flip4 ( &binDenom );
}
if ( (binDenom == 0) && (binNum != 0) ) XMP_Throw ( "OECF-SFR data overflow", kXMPErr_BadValue );
if ( isSigned ) {
snprintf ( buffer, sizeof(buffer), "%ld/%ld", (long)binNum, (long)binDenom ); // AUDIT: Use of sizeof(buffer) is safe.
} else {
snprintf ( buffer, sizeof(buffer), "%lu/%lu", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Use of sizeof(buffer) is safe.
}
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, buffer );
}
return;
} catch ( ... ) {
xmp->DeleteProperty ( xmpNS, xmpProp );
}
} // ImportConversionTable
| DoS | 0 | ImportConversionTable ( const TIFF_Manager::TagInfo & tagInfo, bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
const bool isSigned = (tagInfo.id == kTIFF_OECF);
XMP_Assert ( (tagInfo.id == kTIFF_OECF) || (tagInfo.id == kTIFF_SpatialFrequencyResponse) );
xmp->DeleteProperty ( xmpNS, xmpProp );
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! nativeEndian ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[40];
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
std::string arrayPath;
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Names", &arrayPath );
bytePtr += 4; // Move to the list of names. Don't convert from local text, should really be ASCII.
for ( size_t i = columns; i > 0; --i ) {
size_t nameLen = strlen((XMP_StringPtr)bytePtr) + 1; // ! Include the terminating nul.
if ( (bytePtr + nameLen) > byteEnd ) XMP_Throw ( "OECF-SFR name overflow", kXMPErr_BadValue );
if ( ! ReconcileUtils::IsUTF8 ( bytePtr, nameLen ) ) XMP_Throw ( "OECF-SFR name error", kXMPErr_BadValue );
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, (XMP_StringPtr)bytePtr );
bytePtr += nameLen;
}
if ( (byteEnd - bytePtr) != (8 * columns * rows) ) XMP_Throw ( "OECF-SFR data overflow", kXMPErr_BadValue );
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Values", &arrayPath );
XMP_Uns32 * binPtr = (XMP_Uns32*)bytePtr;
for ( size_t i = (columns * rows); i > 0; --i, binPtr += 2 ) {
XMP_Uns32 binNum = binPtr[0];
XMP_Uns32 binDenom = binPtr[1];
if ( ! nativeEndian ) {
Flip4 ( &binNum );
Flip4 ( &binDenom );
}
if ( (binDenom == 0) && (binNum != 0) ) XMP_Throw ( "OECF-SFR data overflow", kXMPErr_BadValue );
if ( isSigned ) {
snprintf ( buffer, sizeof(buffer), "%ld/%ld", (long)binNum, (long)binDenom ); // AUDIT: Use of sizeof(buffer) is safe.
} else {
snprintf ( buffer, sizeof(buffer), "%lu/%lu", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Use of sizeof(buffer) is safe.
}
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, buffer );
}
return;
} catch ( ... ) {
xmp->DeleteProperty ( xmpNS, xmpProp );
}
} // ImportConversionTable
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,814 | ImportSingleTIFF ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
switch ( tagInfo.type ) {
case kTIFF_ShortType :
ImportSingleTIFF_Short ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_LongType :
ImportSingleTIFF_Long ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_RationalType :
ImportSingleTIFF_Rational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SRationalType :
ImportSingleTIFF_SRational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_ASCIIType :
ImportSingleTIFF_ASCII ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_ByteType :
ImportSingleTIFF_Byte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SByteType :
ImportSingleTIFF_SByte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SShortType :
ImportSingleTIFF_SShort ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SLongType :
ImportSingleTIFF_SLong ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_FloatType :
ImportSingleTIFF_Float ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_DoubleType :
ImportSingleTIFF_Double ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
}
} // ImportSingleTIFF
| DoS | 0 | ImportSingleTIFF ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
switch ( tagInfo.type ) {
case kTIFF_ShortType :
ImportSingleTIFF_Short ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_LongType :
ImportSingleTIFF_Long ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_RationalType :
ImportSingleTIFF_Rational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SRationalType :
ImportSingleTIFF_SRational ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_ASCIIType :
ImportSingleTIFF_ASCII ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_ByteType :
ImportSingleTIFF_Byte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SByteType :
ImportSingleTIFF_SByte ( tagInfo, xmp, xmpNS, xmpProp );
break;
case kTIFF_SShortType :
ImportSingleTIFF_SShort ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_SLongType :
ImportSingleTIFF_SLong ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_FloatType :
ImportSingleTIFF_Float ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
case kTIFF_DoubleType :
ImportSingleTIFF_Double ( tagInfo, nativeEndian, xmp, xmpNS, xmpProp );
break;
}
} // ImportSingleTIFF
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,815 | ImportSingleTIFF_ASCII ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
TrimTrailingSpaces ( (TIFF_Manager::TagInfo*) &tagInfo );
if ( tagInfo.dataLen == 0 ) return; // Ignore empty tags.
const char * chPtr = (const char *)tagInfo.dataPtr;
const bool hasNul = !tagInfo.dataLen || !chPtr || (chPtr[tagInfo.dataLen-1] == 0);
const bool isUTF8 = ReconcileUtils::IsUTF8 ( chPtr, tagInfo.dataLen );
if ( isUTF8 && hasNul ) {
xmp->SetProperty ( xmpNS, xmpProp, chPtr );
} else {
std::string strValue;
if ( isUTF8 ) {
strValue.assign ( chPtr, tagInfo.dataLen );
} else {
if ( ignoreLocalText ) return;
ReconcileUtils::LocalToUTF8 ( chPtr, tagInfo.dataLen, &strValue );
}
xmp->SetProperty ( xmpNS, xmpProp, strValue.c_str() );
}
} catch ( ... ) {
}
} // ImportSingleTIFF_ASCII
| DoS | 0 | ImportSingleTIFF_ASCII ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
TrimTrailingSpaces ( (TIFF_Manager::TagInfo*) &tagInfo );
if ( tagInfo.dataLen == 0 ) return; // Ignore empty tags.
const char * chPtr = (const char *)tagInfo.dataPtr;
const bool hasNul = !tagInfo.dataLen || !chPtr || (chPtr[tagInfo.dataLen-1] == 0);
const bool isUTF8 = ReconcileUtils::IsUTF8 ( chPtr, tagInfo.dataLen );
if ( isUTF8 && hasNul ) {
xmp->SetProperty ( xmpNS, xmpProp, chPtr );
} else {
std::string strValue;
if ( isUTF8 ) {
strValue.assign ( chPtr, tagInfo.dataLen );
} else {
if ( ignoreLocalText ) return;
ReconcileUtils::LocalToUTF8 ( chPtr, tagInfo.dataLen, &strValue );
}
xmp->SetProperty ( xmpNS, xmpProp, strValue.c_str() );
}
} catch ( ... ) {
}
} // ImportSingleTIFF_ASCII
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,816 | ImportSingleTIFF_Byte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns8 binValue = *((XMP_Uns8*)tagInfo.dataPtr);
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", (XMP_Uns16)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Byte
| DoS | 0 | ImportSingleTIFF_Byte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns8 binValue = *((XMP_Uns8*)tagInfo.dataPtr);
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", (XMP_Uns16)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Byte
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,817 | ImportSingleTIFF_Double ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
double binValue = *((double*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip8 ( &binValue );
xmp->SetProperty_Float ( xmpNS, xmpProp, binValue ); // ! Yes, SetProperty_Float.
} catch ( ... ) {
}
} // ImportSingleTIFF_Double
| DoS | 0 | ImportSingleTIFF_Double ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
double binValue = *((double*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip8 ( &binValue );
xmp->SetProperty_Float ( xmpNS, xmpProp, binValue ); // ! Yes, SetProperty_Float.
} catch ( ... ) {
}
} // ImportSingleTIFF_Double
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,818 | ImportSingleTIFF_Float ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
float binValue = *((float*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip4 ( &binValue );
xmp->SetProperty_Float ( xmpNS, xmpProp, binValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Float
| DoS | 0 | ImportSingleTIFF_Float ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
float binValue = *((float*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip4 ( &binValue );
xmp->SetProperty_Float ( xmpNS, xmpProp, binValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Float
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,819 | ImportSingleTIFF_Long ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns32 binValue = GetUns32AsIs ( tagInfo.dataPtr );
if ( ! nativeEndian ) binValue = Flip4 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%lu", (unsigned long)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Long
| DoS | 0 | ImportSingleTIFF_Long ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns32 binValue = GetUns32AsIs ( tagInfo.dataPtr );
if ( ! nativeEndian ) binValue = Flip4 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%lu", (unsigned long)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Long
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,820 | ImportSingleTIFF_SByte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int8 binValue = *((XMP_Int8*)tagInfo.dataPtr);
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", (short)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SByte
| DoS | 0 | ImportSingleTIFF_SByte ( const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int8 binValue = *((XMP_Int8*)tagInfo.dataPtr);
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", (short)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SByte
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,821 | ImportSingleTIFF_SLong ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int32 binValue = *((XMP_Int32*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip4 ( &binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%ld", (long)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SLong
| DoS | 0 | ImportSingleTIFF_SLong ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int32 binValue = *((XMP_Int32*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip4 ( &binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%ld", (long)binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SLong
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,822 | ImportSingleTIFF_SRational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
#if SUNOS_SPARC || XMP_IOS_ARM
XMP_Uns32 binPtr[2];
memcpy(&binPtr, tagInfo.dataPtr, sizeof(XMP_Uns32)*2);
#else
XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr;
#endif //#if SUNOS_SPARC || XMP_IOS_ARM
XMP_Int32 binNum = GetUns32AsIs ( &binPtr[0] );
XMP_Int32 binDenom = GetUns32AsIs ( &binPtr[1] );
if ( ! nativeEndian ) {
Flip4 ( &binNum );
Flip4 ( &binDenom );
}
char strValue[40];
snprintf ( strValue, sizeof(strValue), "%ld/%ld", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SRational
| DoS | 0 | ImportSingleTIFF_SRational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
#if SUNOS_SPARC || XMP_IOS_ARM
XMP_Uns32 binPtr[2];
memcpy(&binPtr, tagInfo.dataPtr, sizeof(XMP_Uns32)*2);
#else
XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr;
#endif //#if SUNOS_SPARC || XMP_IOS_ARM
XMP_Int32 binNum = GetUns32AsIs ( &binPtr[0] );
XMP_Int32 binDenom = GetUns32AsIs ( &binPtr[1] );
if ( ! nativeEndian ) {
Flip4 ( &binNum );
Flip4 ( &binDenom );
}
char strValue[40];
snprintf ( strValue, sizeof(strValue), "%ld/%ld", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SRational
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,823 | ImportSingleTIFF_SShort ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int16 binValue = *((XMP_Int16*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip2 ( &binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SShort
| DoS | 0 | ImportSingleTIFF_SShort ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Int16 binValue = *((XMP_Int16*)tagInfo.dataPtr);
if ( ! nativeEndian ) Flip2 ( &binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hd", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_SShort
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,824 | ImportSingleTIFF_Short ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns16 binValue = GetUns16AsIs ( tagInfo.dataPtr );
if ( ! nativeEndian ) binValue = Flip2 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Short
| DoS | 0 | ImportSingleTIFF_Short ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns16 binValue = GetUns16AsIs ( tagInfo.dataPtr );
if ( ! nativeEndian ) binValue = Flip2 ( binValue );
char strValue[20];
snprintf ( strValue, sizeof(strValue), "%hu", binValue ); // AUDIT: Using sizeof(strValue) is safe.
xmp->SetProperty ( xmpNS, xmpProp, strValue );
} catch ( ... ) {
}
} // ImportSingleTIFF_Short
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,825 | ImportTIFF_CFATable ( const TIFF_Manager::TagInfo & tagInfo, bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! nativeEndian ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[20];
std::string arrayPath;
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
bytePtr += 4; // Move to the matrix of values.
if ( (byteEnd - bytePtr) != (columns * rows) ) goto BadExif; // Make sure the values are present.
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Values", &arrayPath );
for ( size_t i = (columns * rows); i > 0; --i, ++bytePtr ) {
snprintf ( buffer, sizeof(buffer), "%hu", (XMP_Uns16)(*bytePtr) ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, buffer );
}
return;
BadExif: // Ignore the tag if the table is ill-formed.
xmp->DeleteProperty ( xmpNS, xmpProp );
return;
} catch ( ... ) {
}
} // ImportTIFF_CFATable
| DoS | 0 | ImportTIFF_CFATable ( const TIFF_Manager::TagInfo & tagInfo, bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! nativeEndian ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[20];
std::string arrayPath;
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
bytePtr += 4; // Move to the matrix of values.
if ( (byteEnd - bytePtr) != (columns * rows) ) goto BadExif; // Make sure the values are present.
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Values", &arrayPath );
for ( size_t i = (columns * rows); i > 0; --i, ++bytePtr ) {
snprintf ( buffer, sizeof(buffer), "%hu", (XMP_Uns16)(*bytePtr) ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, buffer );
}
return;
BadExif: // Ignore the tag if the table is ill-formed.
xmp->DeleteProperty ( xmpNS, xmpProp );
return;
} catch ( ... ) {
}
} // ImportTIFF_CFATable
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,826 | ImportTIFF_CheckStandardMapping ( const TIFF_Manager::TagInfo & tagInfo, const TIFF_MappingToXMP & mapInfo )
{
XMP_Assert ( (kTIFF_ByteType <= tagInfo.type) && (tagInfo.type <= kTIFF_LastType) );
XMP_Assert ( mapInfo.type <= kTIFF_LastType );
if ( (tagInfo.type < kTIFF_ByteType) || (tagInfo.type > kTIFF_LastType) ) return false;
if ( tagInfo.type != mapInfo.type ) {
if ( kTIFF_IsIntegerType[mapInfo.type] ) {
if ( ! kTIFF_IsIntegerType[tagInfo.type] ) return false;
} else if ( kTIFF_IsRationalType[mapInfo.type] ) {
if ( ! kTIFF_IsRationalType[tagInfo.type] ) return false;
} else if ( kTIFF_IsFloatType[mapInfo.type] ) {
if ( ! kTIFF_IsFloatType[tagInfo.type] ) return false;
} else {
return false;
}
}
if ( (tagInfo.count != mapInfo.count) && // Maybe there is a problem because the counts don't match.
(mapInfo.count == 1) ) return false; // Be tolerant of mismatch in expected array size.
return true;
} // ImportTIFF_CheckStandardMapping
| DoS | 0 | ImportTIFF_CheckStandardMapping ( const TIFF_Manager::TagInfo & tagInfo, const TIFF_MappingToXMP & mapInfo )
{
XMP_Assert ( (kTIFF_ByteType <= tagInfo.type) && (tagInfo.type <= kTIFF_LastType) );
XMP_Assert ( mapInfo.type <= kTIFF_LastType );
if ( (tagInfo.type < kTIFF_ByteType) || (tagInfo.type > kTIFF_LastType) ) return false;
if ( tagInfo.type != mapInfo.type ) {
if ( kTIFF_IsIntegerType[mapInfo.type] ) {
if ( ! kTIFF_IsIntegerType[tagInfo.type] ) return false;
} else if ( kTIFF_IsRationalType[mapInfo.type] ) {
if ( ! kTIFF_IsRationalType[tagInfo.type] ) return false;
} else if ( kTIFF_IsFloatType[mapInfo.type] ) {
if ( ! kTIFF_IsFloatType[tagInfo.type] ) return false;
} else {
return false;
}
}
if ( (tagInfo.count != mapInfo.count) && // Maybe there is a problem because the counts don't match.
(mapInfo.count == 1) ) return false; // Be tolerant of mismatch in expected array size.
return true;
} // ImportTIFF_CheckStandardMapping
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,827 | ImportTIFF_DSDTable ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! tiff.IsNativeEndian() ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[20];
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
std::string arrayPath;
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Settings", &arrayPath );
bytePtr += 4; // Move to the list of settings.
UTF16Unit * utf16Ptr = (UTF16Unit*)bytePtr;
UTF16Unit * utf16End = (UTF16Unit*)byteEnd;
std::string utf8;
while ( utf16Ptr < utf16End ) {
size_t nameLen = 0;
while ( utf16Ptr[nameLen] != 0 ) ++nameLen;
++nameLen; // ! Include the terminating nul.
if ( (utf16Ptr + nameLen) > utf16End ) goto BadExif;
try {
FromUTF16 ( utf16Ptr, nameLen, &utf8, tiff.IsBigEndian() );
} catch ( ... ) {
goto BadExif; // Ignore the tag if there are conversion errors.
}
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, utf8.c_str() );
utf16Ptr += nameLen;
}
return;
BadExif: // Ignore the tag if the table is ill-formed.
xmp->DeleteProperty ( xmpNS, xmpProp );
return;
} catch ( ... ) {
}
} // ImportTIFF_DSDTable
| DoS | 0 | ImportTIFF_DSDTable ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr;
const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen;
XMP_Uns16 columns = *((XMP_Uns16*)bytePtr);
XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2));
if ( ! tiff.IsNativeEndian() ) {
columns = Flip2 ( columns );
rows = Flip2 ( rows );
}
char buffer[20];
snprintf ( buffer, sizeof(buffer), "%d", columns ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Columns", buffer );
snprintf ( buffer, sizeof(buffer), "%d", rows ); // AUDIT: Use of sizeof(buffer) is safe.
xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, "Rows", buffer );
std::string arrayPath;
SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, "Settings", &arrayPath );
bytePtr += 4; // Move to the list of settings.
UTF16Unit * utf16Ptr = (UTF16Unit*)bytePtr;
UTF16Unit * utf16End = (UTF16Unit*)byteEnd;
std::string utf8;
while ( utf16Ptr < utf16End ) {
size_t nameLen = 0;
while ( utf16Ptr[nameLen] != 0 ) ++nameLen;
++nameLen; // ! Include the terminating nul.
if ( (utf16Ptr + nameLen) > utf16End ) goto BadExif;
try {
FromUTF16 ( utf16Ptr, nameLen, &utf8, tiff.IsBigEndian() );
} catch ( ... ) {
goto BadExif; // Ignore the tag if there are conversion errors.
}
xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, utf8.c_str() );
utf16Ptr += nameLen;
}
return;
BadExif: // Ignore the tag if the table is ill-formed.
xmp->DeleteProperty ( xmpNS, xmpProp );
return;
} catch ( ... ) {
}
} // ImportTIFF_DSDTable
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,828 | ImportTIFF_Date ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & dateInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
XMP_Uns16 secID = 0;
switch ( dateInfo.id ) {
case kTIFF_DateTime : secID = kTIFF_SubSecTime; break;
case kTIFF_DateTimeOriginal : secID = kTIFF_SubSecTimeOriginal; break;
case kTIFF_DateTimeDigitized : secID = kTIFF_SubSecTimeDigitized; break;
}
try { // Don't let errors with one stop the others.
if ( (dateInfo.type != kTIFF_ASCIIType) || (dateInfo.count != 20) ) return;
const char * dateStr = (const char *) dateInfo.dataPtr;
if ( (dateStr[4] != ':') || (dateStr[7] != ':') ||
(dateStr[10] != ' ') || (dateStr[13] != ':') || (dateStr[16] != ':') ) return;
XMP_DateTime binValue;
binValue.year = GatherInt ( &dateStr[0], 4 );
binValue.month = GatherInt ( &dateStr[5], 2 );
binValue.day = GatherInt ( &dateStr[8], 2 );
if ( (binValue.year != 0) | (binValue.month != 0) | (binValue.day != 0) ) binValue.hasDate = true;
binValue.hour = GatherInt ( &dateStr[11], 2 );
binValue.minute = GatherInt ( &dateStr[14], 2 );
binValue.second = GatherInt ( &dateStr[17], 2 );
binValue.nanoSecond = 0; // Get the fractional seconds later.
if ( (binValue.hour != 0) | (binValue.minute != 0) | (binValue.second != 0) ) binValue.hasTime = true;
binValue.tzSign = 0; // ! Separate assignment, avoid VS integer truncation warning.
binValue.tzHour = binValue.tzMinute = 0;
binValue.hasTimeZone = false; // Exif times have no zone.
TIFF_Manager::TagInfo secInfo;
bool found = tiff.GetTag ( kTIFF_ExifIFD, secID, &secInfo ); // ! Subseconds are all in the Exif IFD.
if ( found && (secInfo.type == kTIFF_ASCIIType) ) {
const char * fracPtr = (const char *) secInfo.dataPtr;
binValue.nanoSecond = GatherInt ( fracPtr, secInfo.dataLen );
size_t digits = 0;
for ( ; (('0' <= *fracPtr) && (*fracPtr <= '9')); ++fracPtr ) ++digits;
for ( ; digits < 9; ++digits ) binValue.nanoSecond *= 10;
if ( binValue.nanoSecond != 0 ) binValue.hasTime = true;
}
xmp->SetProperty_Date ( xmpNS, xmpProp, binValue );
} catch ( ... ) {
}
} // ImportTIFF_Date
| DoS | 0 | ImportTIFF_Date ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & dateInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
XMP_Uns16 secID = 0;
switch ( dateInfo.id ) {
case kTIFF_DateTime : secID = kTIFF_SubSecTime; break;
case kTIFF_DateTimeOriginal : secID = kTIFF_SubSecTimeOriginal; break;
case kTIFF_DateTimeDigitized : secID = kTIFF_SubSecTimeDigitized; break;
}
try { // Don't let errors with one stop the others.
if ( (dateInfo.type != kTIFF_ASCIIType) || (dateInfo.count != 20) ) return;
const char * dateStr = (const char *) dateInfo.dataPtr;
if ( (dateStr[4] != ':') || (dateStr[7] != ':') ||
(dateStr[10] != ' ') || (dateStr[13] != ':') || (dateStr[16] != ':') ) return;
XMP_DateTime binValue;
binValue.year = GatherInt ( &dateStr[0], 4 );
binValue.month = GatherInt ( &dateStr[5], 2 );
binValue.day = GatherInt ( &dateStr[8], 2 );
if ( (binValue.year != 0) | (binValue.month != 0) | (binValue.day != 0) ) binValue.hasDate = true;
binValue.hour = GatherInt ( &dateStr[11], 2 );
binValue.minute = GatherInt ( &dateStr[14], 2 );
binValue.second = GatherInt ( &dateStr[17], 2 );
binValue.nanoSecond = 0; // Get the fractional seconds later.
if ( (binValue.hour != 0) | (binValue.minute != 0) | (binValue.second != 0) ) binValue.hasTime = true;
binValue.tzSign = 0; // ! Separate assignment, avoid VS integer truncation warning.
binValue.tzHour = binValue.tzMinute = 0;
binValue.hasTimeZone = false; // Exif times have no zone.
TIFF_Manager::TagInfo secInfo;
bool found = tiff.GetTag ( kTIFF_ExifIFD, secID, &secInfo ); // ! Subseconds are all in the Exif IFD.
if ( found && (secInfo.type == kTIFF_ASCIIType) ) {
const char * fracPtr = (const char *) secInfo.dataPtr;
binValue.nanoSecond = GatherInt ( fracPtr, secInfo.dataLen );
size_t digits = 0;
for ( ; (('0' <= *fracPtr) && (*fracPtr <= '9')); ++fracPtr ) ++digits;
for ( ; digits < 9; ++digits ) binValue.nanoSecond *= 10;
if ( binValue.nanoSecond != 0 ) binValue.hasTime = true;
}
xmp->SetProperty_Date ( xmpNS, xmpProp, binValue );
} catch ( ... ) {
}
} // ImportTIFF_Date
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,829 | ImportTIFF_EncodedString ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp, bool isLangAlt = false )
{
try { // Don't let errors with one stop the others.
std::string strValue;
bool ok = tiff.DecodeString ( tagInfo.dataPtr, tagInfo.dataLen, &strValue );
if ( ! ok ) return;
TrimTrailingSpaces ( &strValue );
if ( strValue.empty() ) return;
if ( ! isLangAlt ) {
xmp->SetProperty ( xmpNS, xmpProp, strValue.c_str() );
} else {
xmp->SetLocalizedText ( xmpNS, xmpProp, "", "x-default", strValue.c_str() );
}
} catch ( ... ) {
}
} // ImportTIFF_EncodedString
| DoS | 0 | ImportTIFF_EncodedString ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & tagInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp, bool isLangAlt = false )
{
try { // Don't let errors with one stop the others.
std::string strValue;
bool ok = tiff.DecodeString ( tagInfo.dataPtr, tagInfo.dataLen, &strValue );
if ( ! ok ) return;
TrimTrailingSpaces ( &strValue );
if ( strValue.empty() ) return;
if ( ! isLangAlt ) {
xmp->SetProperty ( xmpNS, xmpProp, strValue.c_str() );
} else {
xmp->SetLocalizedText ( xmpNS, xmpProp, "", "x-default", strValue.c_str() );
}
} catch ( ... ) {
}
} // ImportTIFF_EncodedString
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,830 | ImportTIFF_Flash ( const TIFF_Manager::TagInfo & tagInfo, bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns16 binValue = GetUns16AsIs ( tagInfo.dataPtr );
if ( ! nativeEndian ) binValue = Flip2 ( binValue );
bool fired = (bool)(binValue & 1); // Avoid implicit 0/1 conversion.
int rtrn = (binValue >> 1) & 3;
int mode = (binValue >> 3) & 3;
bool function = (bool)((binValue >> 5) & 1);
bool redEye = (bool)((binValue >> 6) & 1);
static const char * sTwoBits[] = { "0", "1", "2", "3" };
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Fired", (fired ? kXMP_TrueStr : kXMP_FalseStr) );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Return", sTwoBits[rtrn] );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Mode", sTwoBits[mode] );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Function", (function ? kXMP_TrueStr : kXMP_FalseStr) );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "RedEyeMode", (redEye ? kXMP_TrueStr : kXMP_FalseStr) );
} catch ( ... ) {
}
} // ImportTIFF_Flash
| DoS | 0 | ImportTIFF_Flash ( const TIFF_Manager::TagInfo & tagInfo, bool nativeEndian,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
XMP_Uns16 binValue = GetUns16AsIs ( tagInfo.dataPtr );
if ( ! nativeEndian ) binValue = Flip2 ( binValue );
bool fired = (bool)(binValue & 1); // Avoid implicit 0/1 conversion.
int rtrn = (binValue >> 1) & 3;
int mode = (binValue >> 3) & 3;
bool function = (bool)((binValue >> 5) & 1);
bool redEye = (bool)((binValue >> 6) & 1);
static const char * sTwoBits[] = { "0", "1", "2", "3" };
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Fired", (fired ? kXMP_TrueStr : kXMP_FalseStr) );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Return", sTwoBits[rtrn] );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Mode", sTwoBits[mode] );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "Function", (function ? kXMP_TrueStr : kXMP_FalseStr) );
xmp->SetStructField ( kXMP_NS_EXIF, "Flash", kXMP_NS_EXIF, "RedEyeMode", (redEye ? kXMP_TrueStr : kXMP_FalseStr) );
} catch ( ... ) {
}
} // ImportTIFF_Flash
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,831 | ImportTIFF_GPSTimeStamp ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & timeInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const bool nativeEndian = tiff.IsNativeEndian();
bool haveDate;
TIFF_Manager::TagInfo dateInfo;
haveDate = tiff.GetTag ( kTIFF_GPSInfoIFD, kTIFF_GPSDateStamp, &dateInfo );
if ( ! haveDate ) haveDate = tiff.GetTag ( kTIFF_ExifIFD, kTIFF_DateTimeOriginal, &dateInfo );
if ( ! haveDate ) haveDate = tiff.GetTag ( kTIFF_ExifIFD, kTIFF_DateTimeDigitized, &dateInfo );
if ( ! haveDate ) return;
const char * dateStr = (const char *) dateInfo.dataPtr;
if ( ((dateStr[4] != ':') && (dateStr[4] != '-')) || ((dateStr[7] != ':') && (dateStr[7] != '-')) ) return;
if ( (dateStr[10] != 0) && (dateStr[10] != ' ') ) return;
XMP_Uns32 * binPtr = (XMP_Uns32*)timeInfo.dataPtr;
XMP_Uns32 hourNum = GetUns32AsIs ( &binPtr[0] );
XMP_Uns32 hourDenom = GetUns32AsIs ( &binPtr[1] );
XMP_Uns32 minNum = GetUns32AsIs ( &binPtr[2] );
XMP_Uns32 minDenom = GetUns32AsIs ( &binPtr[3] );
XMP_Uns32 secNum = GetUns32AsIs ( &binPtr[4] );
XMP_Uns32 secDenom = GetUns32AsIs ( &binPtr[5] );
if ( ! nativeEndian ) {
hourNum = Flip4 ( hourNum );
hourDenom = Flip4 ( hourDenom );
minNum = Flip4 ( minNum );
minDenom = Flip4 ( minDenom );
secNum = Flip4 ( secNum );
secDenom = Flip4 ( secDenom );
}
double fHour, fMin, fSec, fNano, temp;
fSec = (double)secNum / (double)secDenom;
temp = (double)minNum / (double)minDenom;
fMin = (double)((XMP_Uns32)temp);
fSec += (temp - fMin) * 60.0;
temp = (double)hourNum / (double)hourDenom;
fHour = (double)((XMP_Uns32)temp);
fSec += (temp - fHour) * 3600.0;
temp = (double)((XMP_Uns32)fSec);
fNano = ((fSec - temp) * (1000.0*1000.0*1000.0)) + 0.5; // Try to avoid n999... problems.
fSec = temp;
XMP_DateTime binStamp;
binStamp.year = GatherInt ( dateStr, 4 );
binStamp.month = GatherInt ( dateStr+5, 2 );
binStamp.day = GatherInt ( dateStr+8, 2 );
binStamp.hour = (XMP_Int32)fHour;
binStamp.minute = (XMP_Int32)fMin;
binStamp.second = (XMP_Int32)fSec;
binStamp.nanoSecond = (XMP_Int32)fNano;
binStamp.hasTimeZone = true; // Exif GPS TimeStamp is implicitly UTC.
binStamp.tzSign = kXMP_TimeIsUTC;
binStamp.tzHour = binStamp.tzMinute = 0;
xmp->SetProperty_Date ( xmpNS, xmpProp, binStamp );
} catch ( ... ) {
}
} // ImportTIFF_GPSTimeStamp
| DoS | 0 | ImportTIFF_GPSTimeStamp ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & timeInfo,
SXMPMeta * xmp, const char * xmpNS, const char * xmpProp )
{
try { // Don't let errors with one stop the others.
const bool nativeEndian = tiff.IsNativeEndian();
bool haveDate;
TIFF_Manager::TagInfo dateInfo;
haveDate = tiff.GetTag ( kTIFF_GPSInfoIFD, kTIFF_GPSDateStamp, &dateInfo );
if ( ! haveDate ) haveDate = tiff.GetTag ( kTIFF_ExifIFD, kTIFF_DateTimeOriginal, &dateInfo );
if ( ! haveDate ) haveDate = tiff.GetTag ( kTIFF_ExifIFD, kTIFF_DateTimeDigitized, &dateInfo );
if ( ! haveDate ) return;
const char * dateStr = (const char *) dateInfo.dataPtr;
if ( ((dateStr[4] != ':') && (dateStr[4] != '-')) || ((dateStr[7] != ':') && (dateStr[7] != '-')) ) return;
if ( (dateStr[10] != 0) && (dateStr[10] != ' ') ) return;
XMP_Uns32 * binPtr = (XMP_Uns32*)timeInfo.dataPtr;
XMP_Uns32 hourNum = GetUns32AsIs ( &binPtr[0] );
XMP_Uns32 hourDenom = GetUns32AsIs ( &binPtr[1] );
XMP_Uns32 minNum = GetUns32AsIs ( &binPtr[2] );
XMP_Uns32 minDenom = GetUns32AsIs ( &binPtr[3] );
XMP_Uns32 secNum = GetUns32AsIs ( &binPtr[4] );
XMP_Uns32 secDenom = GetUns32AsIs ( &binPtr[5] );
if ( ! nativeEndian ) {
hourNum = Flip4 ( hourNum );
hourDenom = Flip4 ( hourDenom );
minNum = Flip4 ( minNum );
minDenom = Flip4 ( minDenom );
secNum = Flip4 ( secNum );
secDenom = Flip4 ( secDenom );
}
double fHour, fMin, fSec, fNano, temp;
fSec = (double)secNum / (double)secDenom;
temp = (double)minNum / (double)minDenom;
fMin = (double)((XMP_Uns32)temp);
fSec += (temp - fMin) * 60.0;
temp = (double)hourNum / (double)hourDenom;
fHour = (double)((XMP_Uns32)temp);
fSec += (temp - fHour) * 3600.0;
temp = (double)((XMP_Uns32)fSec);
fNano = ((fSec - temp) * (1000.0*1000.0*1000.0)) + 0.5; // Try to avoid n999... problems.
fSec = temp;
XMP_DateTime binStamp;
binStamp.year = GatherInt ( dateStr, 4 );
binStamp.month = GatherInt ( dateStr+5, 2 );
binStamp.day = GatherInt ( dateStr+8, 2 );
binStamp.hour = (XMP_Int32)fHour;
binStamp.minute = (XMP_Int32)fMin;
binStamp.second = (XMP_Int32)fSec;
binStamp.nanoSecond = (XMP_Int32)fNano;
binStamp.hasTimeZone = true; // Exif GPS TimeStamp is implicitly UTC.
binStamp.tzSign = kXMP_TimeIsUTC;
binStamp.tzHour = binStamp.tzMinute = 0;
xmp->SetProperty_Date ( xmpNS, xmpProp, binStamp );
} catch ( ... ) {
}
} // ImportTIFF_GPSTimeStamp
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,832 | static void ImportTIFF_PhotographicSensitivity ( const TIFF_Manager & exif, SXMPMeta * xmp ) {
try {
bool found;
TIFF_Manager::TagInfo tagInfo;
bool haveOldExif = true; // Default to old Exif if no version tag.
bool haveTag34855 = false;
bool haveLowISO = false; // Set for real if haveTag34855 is true.
XMP_Uns32 valueTag34855; // ! Only care about the first value if more than 1.
found = exif.GetTag ( kTIFF_ExifIFD, kTIFF_ExifVersion, &tagInfo );
if ( found && (tagInfo.type == kTIFF_UndefinedType) && (tagInfo.count == 4) ) {
haveOldExif = (strncmp ( (char*)tagInfo.dataPtr, "0230", 4 ) < 0);
}
haveTag34855 = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, &valueTag34855 );
if ( haveTag34855 ) haveLowISO = (valueTag34855 < 65535);
if ( haveOldExif ) { // Exif version is before 2.3, use just the old tag and property.
if ( haveTag34855 ) {
if ( haveLowISO || (! xmp->DoesPropertyExist ( kXMP_NS_EXIF, "ISOSpeedRatings" )) ) {
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" );
xmp->AppendArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", kXMP_PropArrayIsOrdered, "" );
xmp->SetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", valueTag34855 );
}
}
} else { // Exif version is 2.3 or newer, use the Exif 2.3 tags and properties.
XMP_Uns16 whichLongTag = 0;
XMP_Uns32 sensitivityType, tagValue;
bool haveSensitivityType = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_SensitivityType, &sensitivityType );
if ( haveSensitivityType ) {
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "SensitivityType", sensitivityType );
switch ( sensitivityType ) {
case 1 : // Use StandardOutputSensitivity for both 1 and 4.
case 4 : whichLongTag = kTIFF_StandardOutputSensitivity; break;
case 2 : whichLongTag = kTIFF_RecommendedExposureIndex; break;
case 3 : // Use ISOSpeed for all of 3, 5, 6, and 7.
case 5 :
case 6 :
case 7 : whichLongTag = kTIFF_ISOSpeed; break;
}
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_StandardOutputSensitivity, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "StandardOutputSensitivity", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_RecommendedExposureIndex, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "RecommendedExposureIndex", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_ISOSpeed, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "ISOSpeed", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudeyyy, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "ISOSpeedLatitudeyyy", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudezzz, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "ISOSpeedLatitudezzz", tagValue );
}
if ( haveTag34855 & haveLowISO ) { // The easier low ISO case.
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" );
xmp->AppendArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", kXMP_PropArrayIsOrdered, "" );
xmp->SetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", valueTag34855 );
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", valueTag34855 );
} else { // The more complex high ISO case, or no PhotographicSensitivity tag.
if ( haveTag34855 ) {
XMP_Assert ( valueTag34855 == 65535 );
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", valueTag34855 );
}
if ( whichLongTag != 0 ) {
found = exif.GetTag ( kTIFF_ExifIFD, whichLongTag, &tagInfo );
if ( found && (tagInfo.type == kTIFF_LongType) && (tagInfo.count == 1) ){
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" );
xmp->AppendArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", kXMP_PropArrayIsOrdered, "" );
xmp->SetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", exif.GetUns32 ( tagInfo.dataPtr ) );
}
}
}
}
} catch ( ... ) {
}
} // ImportTIFF_PhotographicSensitivity
| DoS | 0 | static void ImportTIFF_PhotographicSensitivity ( const TIFF_Manager & exif, SXMPMeta * xmp ) {
try {
bool found;
TIFF_Manager::TagInfo tagInfo;
bool haveOldExif = true; // Default to old Exif if no version tag.
bool haveTag34855 = false;
bool haveLowISO = false; // Set for real if haveTag34855 is true.
XMP_Uns32 valueTag34855; // ! Only care about the first value if more than 1.
found = exif.GetTag ( kTIFF_ExifIFD, kTIFF_ExifVersion, &tagInfo );
if ( found && (tagInfo.type == kTIFF_UndefinedType) && (tagInfo.count == 4) ) {
haveOldExif = (strncmp ( (char*)tagInfo.dataPtr, "0230", 4 ) < 0);
}
haveTag34855 = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_PhotographicSensitivity, &valueTag34855 );
if ( haveTag34855 ) haveLowISO = (valueTag34855 < 65535);
if ( haveOldExif ) { // Exif version is before 2.3, use just the old tag and property.
if ( haveTag34855 ) {
if ( haveLowISO || (! xmp->DoesPropertyExist ( kXMP_NS_EXIF, "ISOSpeedRatings" )) ) {
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" );
xmp->AppendArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", kXMP_PropArrayIsOrdered, "" );
xmp->SetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", valueTag34855 );
}
}
} else { // Exif version is 2.3 or newer, use the Exif 2.3 tags and properties.
XMP_Uns16 whichLongTag = 0;
XMP_Uns32 sensitivityType, tagValue;
bool haveSensitivityType = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_SensitivityType, &sensitivityType );
if ( haveSensitivityType ) {
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "SensitivityType", sensitivityType );
switch ( sensitivityType ) {
case 1 : // Use StandardOutputSensitivity for both 1 and 4.
case 4 : whichLongTag = kTIFF_StandardOutputSensitivity; break;
case 2 : whichLongTag = kTIFF_RecommendedExposureIndex; break;
case 3 : // Use ISOSpeed for all of 3, 5, 6, and 7.
case 5 :
case 6 :
case 7 : whichLongTag = kTIFF_ISOSpeed; break;
}
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_StandardOutputSensitivity, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "StandardOutputSensitivity", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_RecommendedExposureIndex, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "RecommendedExposureIndex", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_ISOSpeed, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "ISOSpeed", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudeyyy, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "ISOSpeedLatitudeyyy", tagValue );
}
found = exif.GetTag_Integer ( kTIFF_ExifIFD, kTIFF_ISOSpeedLatitudezzz, &tagValue );
if ( found ) {
xmp->SetProperty_Int64 ( kXMP_NS_ExifEX, "ISOSpeedLatitudezzz", tagValue );
}
if ( haveTag34855 & haveLowISO ) { // The easier low ISO case.
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" );
xmp->AppendArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", kXMP_PropArrayIsOrdered, "" );
xmp->SetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", valueTag34855 );
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", valueTag34855 );
} else { // The more complex high ISO case, or no PhotographicSensitivity tag.
if ( haveTag34855 ) {
XMP_Assert ( valueTag34855 == 65535 );
xmp->SetProperty_Int ( kXMP_NS_ExifEX, "PhotographicSensitivity", valueTag34855 );
}
if ( whichLongTag != 0 ) {
found = exif.GetTag ( kTIFF_ExifIFD, whichLongTag, &tagInfo );
if ( found && (tagInfo.type == kTIFF_LongType) && (tagInfo.count == 1) ){
xmp->DeleteProperty ( kXMP_NS_EXIF, "ISOSpeedRatings" );
xmp->AppendArrayItem ( kXMP_NS_EXIF, "ISOSpeedRatings", kXMP_PropArrayIsOrdered, "" );
xmp->SetProperty_Int ( kXMP_NS_EXIF, "ISOSpeedRatings[1]", exif.GetUns32 ( tagInfo.dataPtr ) );
}
}
}
}
} catch ( ... ) {
}
} // ImportTIFF_PhotographicSensitivity
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,833 | ImportTIFF_StandardMappings ( XMP_Uns8 ifd, const TIFF_Manager & tiff, SXMPMeta * xmp )
{
const bool nativeEndian = tiff.IsNativeEndian();
TIFF_Manager::TagInfo tagInfo;
const TIFF_MappingToXMP * mappings = 0;
if ( ifd == kTIFF_PrimaryIFD ) {
mappings = sPrimaryIFDMappings;
} else if ( ifd == kTIFF_ExifIFD ) {
mappings = sExifIFDMappings;
} else if ( ifd == kTIFF_GPSInfoIFD ) {
mappings = sGPSInfoIFDMappings;
} else {
XMP_Throw ( "Invalid IFD for standard mappings", kXMPErr_InternalFailure );
}
for ( size_t i = 0; mappings[i].id != 0xFFFF; ++i ) {
try { // Don't let errors with one stop the others.
const TIFF_MappingToXMP & mapInfo = mappings[i];
const bool mapSingle = ((mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType));
if ( mapInfo.name[0] == 0 ) continue; // Skip special mappings, handled higher up.
bool found = tiff.GetTag ( ifd, mapInfo.id, &tagInfo );
if ( ! found ) continue;
XMP_Assert ( tagInfo.type != kTIFF_UndefinedType ); // These must have a special mapping.
if ( tagInfo.type == kTIFF_UndefinedType ) continue;
if ( ! ImportTIFF_CheckStandardMapping ( tagInfo, mapInfo ) ) continue;
if ( mapSingle ) {
ImportSingleTIFF ( tagInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name );
} else {
ImportArrayTIFF ( tagInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name );
}
} catch ( ... ) {
}
}
} // ImportTIFF_StandardMappings
| DoS | 0 | ImportTIFF_StandardMappings ( XMP_Uns8 ifd, const TIFF_Manager & tiff, SXMPMeta * xmp )
{
const bool nativeEndian = tiff.IsNativeEndian();
TIFF_Manager::TagInfo tagInfo;
const TIFF_MappingToXMP * mappings = 0;
if ( ifd == kTIFF_PrimaryIFD ) {
mappings = sPrimaryIFDMappings;
} else if ( ifd == kTIFF_ExifIFD ) {
mappings = sExifIFDMappings;
} else if ( ifd == kTIFF_GPSInfoIFD ) {
mappings = sGPSInfoIFDMappings;
} else {
XMP_Throw ( "Invalid IFD for standard mappings", kXMPErr_InternalFailure );
}
for ( size_t i = 0; mappings[i].id != 0xFFFF; ++i ) {
try { // Don't let errors with one stop the others.
const TIFF_MappingToXMP & mapInfo = mappings[i];
const bool mapSingle = ((mapInfo.count == 1) || (mapInfo.type == kTIFF_ASCIIType));
if ( mapInfo.name[0] == 0 ) continue; // Skip special mappings, handled higher up.
bool found = tiff.GetTag ( ifd, mapInfo.id, &tagInfo );
if ( ! found ) continue;
XMP_Assert ( tagInfo.type != kTIFF_UndefinedType ); // These must have a special mapping.
if ( tagInfo.type == kTIFF_UndefinedType ) continue;
if ( ! ImportTIFF_CheckStandardMapping ( tagInfo, mapInfo ) ) continue;
if ( mapSingle ) {
ImportSingleTIFF ( tagInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name );
} else {
ImportArrayTIFF ( tagInfo, nativeEndian, xmp, mapInfo.ns, mapInfo.name );
}
} catch ( ... ) {
}
}
} // ImportTIFF_StandardMappings
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,834 | bool PhotoDataUtils::IsValueDifferent ( const TIFF_Manager::TagInfo & exifInfo, const std::string & xmpValue, std::string * exifValue )
{
if ( exifInfo.dataLen == 0 ) return false; // Ignore empty Exif values.
if ( ReconcileUtils::IsUTF8 ( exifInfo.dataPtr, exifInfo.dataLen ) ) { // ! Note that ASCII is UTF-8.
exifValue->assign ( (char*)exifInfo.dataPtr, exifInfo.dataLen );
} else {
if ( ignoreLocalText ) return false;
ReconcileUtils::LocalToUTF8 ( exifInfo.dataPtr, exifInfo.dataLen, exifValue );
}
return (*exifValue != xmpValue);
} // PhotoDataUtils::IsValueDifferent
| DoS | 0 | bool PhotoDataUtils::IsValueDifferent ( const TIFF_Manager::TagInfo & exifInfo, const std::string & xmpValue, std::string * exifValue )
{
if ( exifInfo.dataLen == 0 ) return false; // Ignore empty Exif values.
if ( ReconcileUtils::IsUTF8 ( exifInfo.dataPtr, exifInfo.dataLen ) ) { // ! Note that ASCII is UTF-8.
exifValue->assign ( (char*)exifInfo.dataPtr, exifInfo.dataLen );
} else {
if ( ignoreLocalText ) return false;
ReconcileUtils::LocalToUTF8 ( exifInfo.dataPtr, exifInfo.dataLen, exifValue );
}
return (*exifValue != xmpValue);
} // PhotoDataUtils::IsValueDifferent
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,835 | static void TrimTrailingSpaces ( std::string * stdstr )
{
size_t origLen = stdstr->size();
size_t newLen = TrimTrailingSpaces ( (char*)stdstr->c_str(), origLen );
if ( newLen != origLen ) stdstr->erase ( newLen );
}
| DoS | 0 | static void TrimTrailingSpaces ( std::string * stdstr )
{
size_t origLen = stdstr->size();
size_t newLen = TrimTrailingSpaces ( (char*)stdstr->c_str(), origLen );
if ( newLen != origLen ) stdstr->erase ( newLen );
}
| @@ -233,7 +233,7 @@ static XMP_Uns32 GatherInt ( const char * strPtr, size_t count )
static size_t TrimTrailingSpaces ( char * firstChar, size_t origLen )
{
- if ( origLen == 0 ) return 0;
+ if ( !firstChar || origLen == 0 ) return 0;
char * lastChar = firstChar + origLen - 1;
if ( (*lastChar != ' ') && (*lastChar != 0) ) return origLen; // Nothing to do. | CWE-416 | null | null |
12,836 | const TIFF_MemoryReader::TweakedIFDEntry* TIFF_MemoryReader::FindTagInIFD ( XMP_Uns8 ifd, XMP_Uns16 id ) const
{
if ( ifd == kTIFF_KnownIFD ) {
}
if ( ifd > kTIFF_LastRealIFD ) XMP_Throw ( "Invalid IFD requested", kXMPErr_InternalFailure );
const TweakedIFDInfo* thisIFD = &containedIFDs[ifd];
if ( thisIFD->count == 0 ) return 0;
XMP_Uns32 spanLength = thisIFD->count;
const TweakedIFDEntry* spanBegin = &(thisIFD->entries[0]);
while ( spanLength > 1 ) {
XMP_Uns32 halfLength = spanLength >> 1; // Since spanLength > 1, halfLength > 0.
const TweakedIFDEntry* spanMiddle = spanBegin + halfLength;
XMP_Uns16 middleID = GetUns16AsIs ( &spanMiddle->id );
if ( middleID == id ) {
spanBegin = spanMiddle;
break;
} else if ( middleID > id ) {
spanLength = halfLength; // Discard the middle.
} else {
spanBegin = spanMiddle; // Keep a valid spanBegin for the return check, don't use spanMiddle+1.
spanLength -= halfLength;
}
}
if ( GetUns16AsIs(&spanBegin->id) != id ) spanBegin = 0;
return spanBegin;
} // TIFF_MemoryReader::FindTagInIFD
| DoS | 0 | const TIFF_MemoryReader::TweakedIFDEntry* TIFF_MemoryReader::FindTagInIFD ( XMP_Uns8 ifd, XMP_Uns16 id ) const
{
if ( ifd == kTIFF_KnownIFD ) {
}
if ( ifd > kTIFF_LastRealIFD ) XMP_Throw ( "Invalid IFD requested", kXMPErr_InternalFailure );
const TweakedIFDInfo* thisIFD = &containedIFDs[ifd];
if ( thisIFD->count == 0 ) return 0;
XMP_Uns32 spanLength = thisIFD->count;
const TweakedIFDEntry* spanBegin = &(thisIFD->entries[0]);
while ( spanLength > 1 ) {
XMP_Uns32 halfLength = spanLength >> 1; // Since spanLength > 1, halfLength > 0.
const TweakedIFDEntry* spanMiddle = spanBegin + halfLength;
XMP_Uns16 middleID = GetUns16AsIs ( &spanMiddle->id );
if ( middleID == id ) {
spanBegin = spanMiddle;
break;
} else if ( middleID > id ) {
spanLength = halfLength; // Discard the middle.
} else {
spanBegin = spanMiddle; // Keep a valid spanBegin for the return check, don't use spanMiddle+1.
spanLength -= halfLength;
}
}
if ( GetUns16AsIs(&spanBegin->id) != id ) spanBegin = 0;
return spanBegin;
} // TIFF_MemoryReader::FindTagInIFD
| @@ -70,7 +70,7 @@ void TIFF_MemoryReader::SortIFD ( TweakedIFDInfo* thisIFD )
} else if ( thisTag == prevTag ) {
// Duplicate tag, keep the 2nd copy, move the tail of the array up, prevTag is unchanged.
- memcpy ( &ifdEntries[i-1], &ifdEntries[i], 12*(tagCount-i) ); // AUDIT: Safe, moving tail forward, i >= 1.
+ memmove ( &ifdEntries[i-1], &ifdEntries[i], 12*(tagCount-i) ); // may overlap -- Hub
--tagCount;
--i; // ! Don't move forward in the array, we've moved the unseen part up.
@@ -86,7 +86,7 @@ void TIFF_MemoryReader::SortIFD ( TweakedIFDInfo* thisIFD )
// Out of order duplicate, move it to position j, move the tail of the array up.
ifdEntries[j] = ifdEntries[i];
- memcpy ( &ifdEntries[i], &ifdEntries[i+1], 12*(tagCount-(i+1)) ); // AUDIT: Safe, moving tail forward, i >= 1.
+ memmove ( &ifdEntries[i], &ifdEntries[i+1], 12*(tagCount-(i+1)) ); // may overlap -- Hub
--tagCount;
--i; // ! Don't move forward in the array, we've moved the unseen part up.
@@ -232,7 +232,11 @@ bool TIFF_MemoryReader::GetTag ( XMP_Uns8 ifd, XMP_Uns16 id, TagInfo* info ) con
info->dataLen = thisBytes;
info->dataPtr = this->GetDataPtr ( thisTag );
-
+ // Here we know that if it is NULL, it is wrong. -- Hub
+ // GetDataPtr will return NULL in case of overflow.
+ if (info->dataPtr == NULL) {
+ return false;
+ }
}
return true; | CWE-416 | null | null |
12,837 | static bool _xmp_error_callback(void* context, XMP_ErrorSeverity severity,
XMP_Int32 cause, XMP_StringPtr message)
{
return false;
}
| DoS | 0 | static bool _xmp_error_callback(void* context, XMP_ErrorSeverity severity,
XMP_Int32 cause, XMP_StringPtr message)
{
return false;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,838 | static void create_tls_key()
{
(void)pthread_key_create(&key, destroy_tls_key);
}
| DoS | 0 | static void create_tls_key()
{
(void)pthread_key_create(&key, destroy_tls_key);
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,839 | static void destroy_tls_key(void *ptr)
{
int *err_ptr = static_cast<int *>(ptr);
delete err_ptr;
}
| DoS | 0 | static void destroy_tls_key(void *ptr)
{
int *err_ptr = static_cast<int *>(ptr);
delete err_ptr;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,840 | static int get_error_for_thread()
{
int *err_ptr;
pthread_once(&key_once, create_tls_key);
err_ptr = (int *)pthread_getspecific(key);
if (err_ptr == NULL) {
return 0;
}
return *err_ptr;
}
| DoS | 0 | static int get_error_for_thread()
{
int *err_ptr;
pthread_once(&key_once, create_tls_key);
err_ptr = (int *)pthread_getspecific(key);
if (err_ptr == NULL) {
return 0;
}
return *err_ptr;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,841 | static void set_error(int err)
{
g_error = err;
}
| DoS | 0 | static void set_error(int err)
{
g_error = err;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,842 | static void set_error(int err)
{
int *err_ptr;
pthread_once(&key_once, create_tls_key);
err_ptr = (int *)pthread_getspecific(key);
if (err_ptr == NULL) {
err_ptr = new int;
pthread_setspecific(key, err_ptr);
}
*err_ptr = err;
}
| DoS | 0 | static void set_error(int err)
{
int *err_ptr;
pthread_once(&key_once, create_tls_key);
err_ptr = (int *)pthread_getspecific(key);
if (err_ptr == NULL) {
err_ptr = new int;
pthread_setspecific(key, err_ptr);
}
*err_ptr = err;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,843 | bool xmp_append_array_item(XmpPtr xmp, const char *schema, const char *name,
uint32_t arrayOptions, const char *value,
uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->AppendArrayItem(schema, name, arrayOptions, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| DoS | 0 | bool xmp_append_array_item(XmpPtr xmp, const char *schema, const char *name,
uint32_t arrayOptions, const char *value,
uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->AppendArrayItem(schema, name, arrayOptions, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,844 | XmpPtr xmp_copy(XmpPtr xmp)
{
CHECK_PTR(xmp, NULL);
RESET_ERROR;
try {
auto txmp = std::unique_ptr<SXMPMeta>(new SXMPMeta(*(SXMPMeta *)xmp));
return reinterpret_cast<XmpPtr>(txmp.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| DoS | 0 | XmpPtr xmp_copy(XmpPtr xmp)
{
CHECK_PTR(xmp, NULL);
RESET_ERROR;
try {
auto txmp = std::unique_ptr<SXMPMeta>(new SXMPMeta(*(SXMPMeta *)xmp));
return reinterpret_cast<XmpPtr>(txmp.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,845 | int xmp_datetime_compare(XmpDateTime *left, XmpDateTime *right)
{
if (!left && !right) {
return 0;
}
if (!left) {
return -1;
}
if (!right) {
return 1;
}
XMP_DateTime _left;
ASSIGN(_left, *left);
XMP_DateTime _right;
ASSIGN(_right, *right);
return XMPUtils::CompareDateTime(_left, _right);
}
| DoS | 0 | int xmp_datetime_compare(XmpDateTime *left, XmpDateTime *right)
{
if (!left && !right) {
return 0;
}
if (!left) {
return -1;
}
if (!right) {
return 1;
}
XMP_DateTime _left;
ASSIGN(_left, *left);
XMP_DateTime _right;
ASSIGN(_right, *right);
return XMPUtils::CompareDateTime(_left, _right);
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,846 | bool xmp_delete_localized_text(XmpPtr xmp, const char *schema, const char *name,
const char *genericLang,
const char *specificLang)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->DeleteLocalizedText(schema, name, genericLang, specificLang);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| DoS | 0 | bool xmp_delete_localized_text(XmpPtr xmp, const char *schema, const char *name,
const char *genericLang,
const char *specificLang)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->DeleteLocalizedText(schema, name, genericLang, specificLang);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,847 | bool xmp_delete_property(XmpPtr xmp, const char *schema, const char *name)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->DeleteProperty(schema, name);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| DoS | 0 | bool xmp_delete_property(XmpPtr xmp, const char *schema, const char *name)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->DeleteProperty(schema, name);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,848 | bool xmp_files_can_put_xmp_cstr(XmpFilePtr xf, const char* xmp_packet, size_t len)
{
CHECK_PTR(xf, false);
RESET_ERROR;
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
bool result = false;
try {
result = txf->CanPutXMP(xmp_packet, len);
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return result;
}
| DoS | 0 | bool xmp_files_can_put_xmp_cstr(XmpFilePtr xf, const char* xmp_packet, size_t len)
{
CHECK_PTR(xf, false);
RESET_ERROR;
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
bool result = false;
try {
result = txf->CanPutXMP(xmp_packet, len);
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return result;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,849 | bool xmp_files_can_put_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet)
{
CHECK_PTR(xf, false);
RESET_ERROR;
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
bool result = false;
try {
result = txf->CanPutXMP(*reinterpret_cast<const std::string*>(xmp_packet));
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return result;
}
| DoS | 0 | bool xmp_files_can_put_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet)
{
CHECK_PTR(xf, false);
RESET_ERROR;
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
bool result = false;
try {
result = txf->CanPutXMP(*reinterpret_cast<const std::string*>(xmp_packet));
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return result;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,850 | XmpFileType xmp_files_check_file_format(const char *filePath)
{
CHECK_PTR(filePath, XMP_FT_UNKNOWN);
RESET_ERROR;
XmpFileType file_type = XMP_FT_UNKNOWN;
try {
file_type = (XmpFileType)SXMPFiles::CheckFileFormat(filePath);
}
catch (const XMP_Error &e) {
set_error(e);
return XMP_FT_UNKNOWN;
}
return file_type;
}
| DoS | 0 | XmpFileType xmp_files_check_file_format(const char *filePath)
{
CHECK_PTR(filePath, XMP_FT_UNKNOWN);
RESET_ERROR;
XmpFileType file_type = XMP_FT_UNKNOWN;
try {
file_type = (XmpFileType)SXMPFiles::CheckFileFormat(filePath);
}
catch (const XMP_Error &e) {
set_error(e);
return XMP_FT_UNKNOWN;
}
return file_type;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,851 | bool xmp_files_close(XmpFilePtr xf, XmpCloseFileOptions options)
{
CHECK_PTR(xf, false);
RESET_ERROR;
try {
auto txf = reinterpret_cast<SXMPFiles *>(xf);
txf->CloseFile(options);
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| DoS | 0 | bool xmp_files_close(XmpFilePtr xf, XmpCloseFileOptions options)
{
CHECK_PTR(xf, false);
RESET_ERROR;
try {
auto txf = reinterpret_cast<SXMPFiles *>(xf);
txf->CloseFile(options);
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,852 | bool xmp_files_free(XmpFilePtr xf)
{
CHECK_PTR(xf, false);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
try {
delete txf;
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| DoS | 0 | bool xmp_files_free(XmpFilePtr xf)
{
CHECK_PTR(xf, false);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
try {
delete txf;
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,853 | bool xmp_files_get_format_info(XmpFileType format,
XmpFileFormatOptions *options)
{
RESET_ERROR;
bool result = false;
try {
result = SXMPFiles::GetFormatInfo(format, (XMP_OptionBits *)options);
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return result;
}
| DoS | 0 | bool xmp_files_get_format_info(XmpFileType format,
XmpFileFormatOptions *options)
{
RESET_ERROR;
bool result = false;
try {
result = SXMPFiles::GetFormatInfo(format, (XMP_OptionBits *)options);
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return result;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,854 | XmpPtr xmp_files_get_new_xmp(XmpFilePtr xf)
{
CHECK_PTR(xf, NULL);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
bool result = false;
try {
auto xmp = std::unique_ptr<SXMPMeta>(new SXMPMeta);
result = txf->GetXMP(xmp.get());
if (result) {
return reinterpret_cast<XmpPtr>(xmp.release());
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| DoS | 0 | XmpPtr xmp_files_get_new_xmp(XmpFilePtr xf)
{
CHECK_PTR(xf, NULL);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
bool result = false;
try {
auto xmp = std::unique_ptr<SXMPMeta>(new SXMPMeta);
result = txf->GetXMP(xmp.get());
if (result) {
return reinterpret_cast<XmpPtr>(xmp.release());
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,855 | bool xmp_files_get_xmp(XmpFilePtr xf, XmpPtr xmp)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp, false);
RESET_ERROR;
bool result = false;
try {
auto txf = reinterpret_cast<SXMPFiles *>(xf);
result = txf->GetXMP(reinterpret_cast<SXMPMeta *>(xmp));
}
catch (const XMP_Error &e) {
set_error(e);
}
return result;
}
| DoS | 0 | bool xmp_files_get_xmp(XmpFilePtr xf, XmpPtr xmp)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp, false);
RESET_ERROR;
bool result = false;
try {
auto txf = reinterpret_cast<SXMPFiles *>(xf);
result = txf->GetXMP(reinterpret_cast<SXMPMeta *>(xmp));
}
catch (const XMP_Error &e) {
set_error(e);
}
return result;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,856 | bool xmp_files_get_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet,
XmpPacketInfo* packet_info)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp_packet, false);
RESET_ERROR;
bool result = false;
try {
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
XMP_PacketInfo xmp_packet_info;
result = txf->GetXMP(NULL,
reinterpret_cast<std::string*>(xmp_packet),
&xmp_packet_info);
if (packet_info) {
packet_info->offset = xmp_packet_info.offset;
packet_info->length = xmp_packet_info.length;
packet_info->padSize = xmp_packet_info.padSize;
packet_info->charForm = xmp_packet_info.charForm;
packet_info->writeable = xmp_packet_info.writeable;
packet_info->hasWrapper = xmp_packet_info.hasWrapper;
packet_info->pad = xmp_packet_info.pad;
}
}
catch(const XMP_Error & e) {
set_error(e);
}
return result;
}
| DoS | 0 | bool xmp_files_get_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet,
XmpPacketInfo* packet_info)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp_packet, false);
RESET_ERROR;
bool result = false;
try {
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
XMP_PacketInfo xmp_packet_info;
result = txf->GetXMP(NULL,
reinterpret_cast<std::string*>(xmp_packet),
&xmp_packet_info);
if (packet_info) {
packet_info->offset = xmp_packet_info.offset;
packet_info->length = xmp_packet_info.length;
packet_info->padSize = xmp_packet_info.padSize;
packet_info->charForm = xmp_packet_info.charForm;
packet_info->writeable = xmp_packet_info.writeable;
packet_info->hasWrapper = xmp_packet_info.hasWrapper;
packet_info->pad = xmp_packet_info.pad;
}
}
catch(const XMP_Error & e) {
set_error(e);
}
return result;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,857 | XmpFilePtr xmp_files_new()
{
RESET_ERROR;
try {
auto txf = std::unique_ptr<SXMPFiles>(new SXMPFiles());
return reinterpret_cast<XmpFilePtr>(txf.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| DoS | 0 | XmpFilePtr xmp_files_new()
{
RESET_ERROR;
try {
auto txf = std::unique_ptr<SXMPFiles>(new SXMPFiles());
return reinterpret_cast<XmpFilePtr>(txf.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,858 | bool xmp_files_open(XmpFilePtr xf, const char *path, XmpOpenFileOptions options)
{
CHECK_PTR(xf, false);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
try {
return txf->OpenFile(path, XMP_FT_UNKNOWN, options);
}
catch (const XMP_Error &e) {
set_error(e);
}
return false;
}
| DoS | 0 | bool xmp_files_open(XmpFilePtr xf, const char *path, XmpOpenFileOptions options)
{
CHECK_PTR(xf, false);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
try {
return txf->OpenFile(path, XMP_FT_UNKNOWN, options);
}
catch (const XMP_Error &e) {
set_error(e);
}
return false;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,859 | XmpFilePtr xmp_files_open_new(const char *path, XmpOpenFileOptions options)
{
CHECK_PTR(path, NULL);
RESET_ERROR;
try {
auto txf = std::unique_ptr<SXMPFiles>(new SXMPFiles);
txf->OpenFile(path, XMP_FT_UNKNOWN, options);
return reinterpret_cast<XmpFilePtr>(txf.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| DoS | 0 | XmpFilePtr xmp_files_open_new(const char *path, XmpOpenFileOptions options)
{
CHECK_PTR(path, NULL);
RESET_ERROR;
try {
auto txf = std::unique_ptr<SXMPFiles>(new SXMPFiles);
txf->OpenFile(path, XMP_FT_UNKNOWN, options);
return reinterpret_cast<XmpFilePtr>(txf.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,860 | bool xmp_files_put_xmp(XmpFilePtr xf, XmpPtr xmp)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp, false);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
try {
txf->PutXMP(*reinterpret_cast<const SXMPMeta *>(xmp));
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| DoS | 0 | bool xmp_files_put_xmp(XmpFilePtr xf, XmpPtr xmp)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp, false);
RESET_ERROR;
auto txf = reinterpret_cast<SXMPFiles *>(xf);
try {
txf->PutXMP(*reinterpret_cast<const SXMPMeta *>(xmp));
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,861 | bool xmp_files_put_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp_packet, false);
RESET_ERROR;
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
try {
txf->PutXMP(*reinterpret_cast<const std::string*>(xmp_packet));
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return true;
}
| DoS | 0 | bool xmp_files_put_xmp_xmpstring(XmpFilePtr xf, XmpStringPtr xmp_packet)
{
CHECK_PTR(xf, false);
CHECK_PTR(xmp_packet, false);
RESET_ERROR;
SXMPFiles *txf = reinterpret_cast<SXMPFiles*>(xf);
try {
txf->PutXMP(*reinterpret_cast<const std::string*>(xmp_packet));
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,862 | bool xmp_get_array_item(XmpPtr xmp, const char *schema, const char *name,
int32_t index, XmpStringPtr property,
uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetArrayItem(schema, name, index, STRING(property),
&optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| DoS | 0 | bool xmp_get_array_item(XmpPtr xmp, const char *schema, const char *name,
int32_t index, XmpStringPtr property,
uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetArrayItem(schema, name, index, STRING(property),
&optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,863 | int xmp_get_error()
{
#if HAVE_NATIVE_TLS
return g_error;
#else
return get_error_for_thread();
#endif
}
| DoS | 0 | int xmp_get_error()
{
#if HAVE_NATIVE_TLS
return g_error;
#else
return get_error_for_thread();
#endif
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,864 | bool xmp_get_localized_text(XmpPtr xmp, const char *schema, const char *name,
const char *genericLang, const char *specificLang,
XmpStringPtr actualLang, XmpStringPtr itemValue,
uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetLocalizedText(schema, name, genericLang, specificLang,
STRING(actualLang), STRING(itemValue),
&optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
return ret;
}
| DoS | 0 | bool xmp_get_localized_text(XmpPtr xmp, const char *schema, const char *name,
const char *genericLang, const char *specificLang,
XmpStringPtr actualLang, XmpStringPtr itemValue,
uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetLocalizedText(schema, name, genericLang, specificLang,
STRING(actualLang), STRING(itemValue),
&optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,865 | bool xmp_get_property_bool(XmpPtr xmp, const char *schema, const char *name,
bool *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetProperty_Bool(schema, name, property, &optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| DoS | 0 | bool xmp_get_property_bool(XmpPtr xmp, const char *schema, const char *name,
bool *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetProperty_Bool(schema, name, property, &optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,866 | bool xmp_get_property_date(XmpPtr xmp, const char *schema, const char *name,
XmpDateTime *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
XMP_DateTime dt;
ret = txmp->GetProperty_Date(schema, name, &dt, &optionBits);
ASSIGN((*property), dt);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| DoS | 0 | bool xmp_get_property_date(XmpPtr xmp, const char *schema, const char *name,
XmpDateTime *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
XMP_DateTime dt;
ret = txmp->GetProperty_Date(schema, name, &dt, &optionBits);
ASSIGN((*property), dt);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,867 | bool xmp_get_property_int32(XmpPtr xmp, const char *schema, const char *name,
int32_t *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetProperty_Int(schema, name, property, &optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| DoS | 0 | bool xmp_get_property_int32(XmpPtr xmp, const char *schema, const char *name,
int32_t *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetProperty_Int(schema, name, property, &optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,868 | bool xmp_get_property_int64(XmpPtr xmp, const char *schema, const char *name,
int64_t *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetProperty_Int64(schema, name, property, &optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| DoS | 0 | bool xmp_get_property_int64(XmpPtr xmp, const char *schema, const char *name,
int64_t *property, uint32_t *propsBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
try {
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
XMP_OptionBits optionBits;
ret = txmp->GetProperty_Int64(schema, name, property, &optionBits);
if (propsBits) {
*propsBits = optionBits;
}
}
catch (const XMP_Error &e) {
set_error(e);
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,869 | bool xmp_has_property(XmpPtr xmp, const char *schema, const char *name)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
try {
ret = txmp->DoesPropertyExist(schema, name);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| DoS | 0 | bool xmp_has_property(XmpPtr xmp, const char *schema, const char *name)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<const SXMPMeta *>(xmp);
try {
ret = txmp->DoesPropertyExist(schema, name);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,870 | bool xmp_iterator_free(XmpIteratorPtr iter)
{
CHECK_PTR(iter, false);
RESET_ERROR;
auto titer = reinterpret_cast<SXMPIterator *>(iter);
delete titer;
return true;
}
| DoS | 0 | bool xmp_iterator_free(XmpIteratorPtr iter)
{
CHECK_PTR(iter, false);
RESET_ERROR;
auto titer = reinterpret_cast<SXMPIterator *>(iter);
delete titer;
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,871 | XmpIteratorPtr xmp_iterator_new(XmpPtr xmp, const char *schema,
const char *propName, XmpIterOptions options)
{
CHECK_PTR(xmp, NULL);
RESET_ERROR;
try {
auto xiter = std::unique_ptr<SXMPIterator>(
new SXMPIterator(*(SXMPMeta *)xmp, schema, propName, options));
return reinterpret_cast<XmpIteratorPtr>(xiter.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| DoS | 0 | XmpIteratorPtr xmp_iterator_new(XmpPtr xmp, const char *schema,
const char *propName, XmpIterOptions options)
{
CHECK_PTR(xmp, NULL);
RESET_ERROR;
try {
auto xiter = std::unique_ptr<SXMPIterator>(
new SXMPIterator(*(SXMPMeta *)xmp, schema, propName, options));
return reinterpret_cast<XmpIteratorPtr>(xiter.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,872 | bool xmp_iterator_next(XmpIteratorPtr iter, XmpStringPtr schema,
XmpStringPtr propName, XmpStringPtr propValue,
uint32_t *options)
{
CHECK_PTR(iter, false);
RESET_ERROR;
auto titer = reinterpret_cast<SXMPIterator *>(iter);
return titer->Next(reinterpret_cast<std::string *>(schema),
reinterpret_cast<std::string *>(propName),
reinterpret_cast<std::string *>(propValue), options);
}
| DoS | 0 | bool xmp_iterator_next(XmpIteratorPtr iter, XmpStringPtr schema,
XmpStringPtr propName, XmpStringPtr propValue,
uint32_t *options)
{
CHECK_PTR(iter, false);
RESET_ERROR;
auto titer = reinterpret_cast<SXMPIterator *>(iter);
return titer->Next(reinterpret_cast<std::string *>(schema),
reinterpret_cast<std::string *>(propName),
reinterpret_cast<std::string *>(propValue), options);
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,873 | bool xmp_iterator_skip(XmpIteratorPtr iter, XmpIterSkipOptions options)
{
CHECK_PTR(iter, false);
RESET_ERROR;
auto titer = reinterpret_cast<SXMPIterator *>(iter);
titer->Skip(options);
return true;
}
| DoS | 0 | bool xmp_iterator_skip(XmpIteratorPtr iter, XmpIterSkipOptions options)
{
CHECK_PTR(iter, false);
RESET_ERROR;
auto titer = reinterpret_cast<SXMPIterator *>(iter);
titer->Skip(options);
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,874 | XmpPtr xmp_new(const char *buffer, size_t len)
{
CHECK_PTR(buffer, NULL);
RESET_ERROR;
try {
auto txmp = std::unique_ptr<SXMPMeta>(new SXMPMeta(buffer, len));
return reinterpret_cast<XmpPtr>(txmp.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| DoS | 0 | XmpPtr xmp_new(const char *buffer, size_t len)
{
CHECK_PTR(buffer, NULL);
RESET_ERROR;
try {
auto txmp = std::unique_ptr<SXMPMeta>(new SXMPMeta(buffer, len));
return reinterpret_cast<XmpPtr>(txmp.release());
}
catch (const XMP_Error &e) {
set_error(e);
}
return NULL;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,875 | XmpPtr xmp_new_empty()
{
RESET_ERROR;
SXMPMeta *txmp = new SXMPMeta;
return (XmpPtr)txmp;
}
| DoS | 0 | XmpPtr xmp_new_empty()
{
RESET_ERROR;
SXMPMeta *txmp = new SXMPMeta;
return (XmpPtr)txmp;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,876 | bool xmp_register_namespace(const char *namespaceURI,
const char *suggestedPrefix,
XmpStringPtr registeredPrefix)
{
RESET_ERROR;
try {
return SXMPMeta::RegisterNamespace(namespaceURI, suggestedPrefix,
STRING(registeredPrefix));
}
catch (const XMP_Error &e) {
set_error(e);
}
return false;
}
| DoS | 0 | bool xmp_register_namespace(const char *namespaceURI,
const char *suggestedPrefix,
XmpStringPtr registeredPrefix)
{
RESET_ERROR;
try {
return SXMPMeta::RegisterNamespace(namespaceURI, suggestedPrefix,
STRING(registeredPrefix));
}
catch (const XMP_Error &e) {
set_error(e);
}
return false;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,877 | bool xmp_serialize_and_format(XmpPtr xmp, XmpStringPtr buffer, uint32_t options,
uint32_t padding, const char *newline,
const char *tab, int32_t indent)
{
CHECK_PTR(xmp, false);
CHECK_PTR(buffer, false);
RESET_ERROR;
SXMPMeta *txmp = (SXMPMeta *)xmp;
try {
txmp->SerializeToBuffer(STRING(buffer), options, padding, newline, tab,
indent);
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| DoS | 0 | bool xmp_serialize_and_format(XmpPtr xmp, XmpStringPtr buffer, uint32_t options,
uint32_t padding, const char *newline,
const char *tab, int32_t indent)
{
CHECK_PTR(xmp, false);
CHECK_PTR(buffer, false);
RESET_ERROR;
SXMPMeta *txmp = (SXMPMeta *)xmp;
try {
txmp->SerializeToBuffer(STRING(buffer), options, padding, newline, tab,
indent);
}
catch (const XMP_Error &e) {
set_error(e);
return false;
}
return true;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,878 | bool xmp_set_array_item(XmpPtr xmp, const char *schema, const char *name,
int32_t index, const char *value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetArrayItem(schema, name, index, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| DoS | 0 | bool xmp_set_array_item(XmpPtr xmp, const char *schema, const char *name,
int32_t index, const char *value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetArrayItem(schema, name, index, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,879 | bool xmp_set_localized_text(XmpPtr xmp, const char *schema, const char *name,
const char *genericLang, const char *specificLang,
const char *value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetLocalizedText(schema, name, genericLang, specificLang, value,
optionBits);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| DoS | 0 | bool xmp_set_localized_text(XmpPtr xmp, const char *schema, const char *name,
const char *genericLang, const char *specificLang,
const char *value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = true;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetLocalizedText(schema, name, genericLang, specificLang, value,
optionBits);
}
catch (const XMP_Error &e) {
set_error(e);
ret = false;
}
catch (...) {
ret = false;
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,880 | bool xmp_set_property(XmpPtr xmp, const char *schema, const char *name,
const char *value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
if ((optionBits & (XMP_PROP_VALUE_IS_STRUCT | XMP_PROP_VALUE_IS_ARRAY)) &&
(*value == 0)) {
value = NULL;
}
try {
txmp->SetProperty(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| DoS | 0 | bool xmp_set_property(XmpPtr xmp, const char *schema, const char *name,
const char *value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
if ((optionBits & (XMP_PROP_VALUE_IS_STRUCT | XMP_PROP_VALUE_IS_ARRAY)) &&
(*value == 0)) {
value = NULL;
}
try {
txmp->SetProperty(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,881 | bool xmp_set_property_float(XmpPtr xmp, const char *schema, const char *name,
double value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetProperty_Float(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| DoS | 0 | bool xmp_set_property_float(XmpPtr xmp, const char *schema, const char *name,
double value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetProperty_Float(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,882 | bool xmp_set_property_int32(XmpPtr xmp, const char *schema, const char *name,
int32_t value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetProperty_Int(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| DoS | 0 | bool xmp_set_property_int32(XmpPtr xmp, const char *schema, const char *name,
int32_t value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetProperty_Int(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,883 | bool xmp_set_property_int64(XmpPtr xmp, const char *schema, const char *name,
int64_t value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetProperty_Int64(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| DoS | 0 | bool xmp_set_property_int64(XmpPtr xmp, const char *schema, const char *name,
int64_t value, uint32_t optionBits)
{
CHECK_PTR(xmp, false);
RESET_ERROR;
bool ret = false;
auto txmp = reinterpret_cast<SXMPMeta *>(xmp);
try {
txmp->SetProperty_Int64(schema, name, value, optionBits);
ret = true;
}
catch (const XMP_Error &e) {
set_error(e);
}
catch (...) {
}
return ret;
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,884 | size_t xmp_string_len(XmpStringPtr s)
{
CHECK_PTR(s, 0);
return reinterpret_cast<const std::string *>(s)->size();
}
| DoS | 0 | size_t xmp_string_len(XmpStringPtr s)
{
CHECK_PTR(s, 0);
return reinterpret_cast<const std::string *>(s)->size();
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,885 | void xmp_terminate()
{
RESET_ERROR;
SXMPFiles::Terminate();
}
| DoS | 0 | void xmp_terminate()
{
RESET_ERROR;
SXMPFiles::Terminate();
}
| @@ -195,10 +195,8 @@ bool xmp_init()
RESET_ERROR;
try {
// no need to initialize anything else.
- // XMP SDK 5.1.2 needs this because it has been lobotomized of local
- // text
- // conversion
- // the one that was done in Exempi with libiconv.
+ // XMP SDK 5.1.2 needs this because it has been stripped off local
+ // text conversion the one that was done in Exempi with libiconv.
bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText);
SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1);
return result; | CWE-416 | null | null |
12,886 | ContainerChunk::ContainerChunk( ContainerChunk* parent, XMP_Uns32 id, XMP_Uns32 containerType ) : Chunk( NULL /* !! */, chunk_CONTAINER, id )
{
XMP_Enforce( parent != NULL );
this->containerType = containerType;
this->newSize = 12;
this->parent = parent;
chunkVect* siblings = &parent->children;
siblings->push_back( this );
}
| DoS Overflow | 0 | ContainerChunk::ContainerChunk( ContainerChunk* parent, XMP_Uns32 id, XMP_Uns32 containerType ) : Chunk( NULL /* !! */, chunk_CONTAINER, id )
{
XMP_Enforce( parent != NULL );
this->containerType = containerType;
this->newSize = 12;
this->parent = parent;
chunkVect* siblings = &parent->children;
siblings->push_back( this );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,887 | ContainerChunk::ContainerChunk( ContainerChunk* parent, RIFF_MetaHandler* handler ) : Chunk( parent, handler, false, chunk_CONTAINER )
{
bool repairMode = ( 0 != ( handler->parent->openFlags & kXMPFiles_OpenRepairFile ));
try
{
XMP_IO* file = handler->parent->ioRef;
XMP_Uns8 level = handler->level;
this->containerType = XIO::ReadUns32_LE( file );
if ( level == 0 && handler->riffChunks.size() > 0 )
{
XMP_Validate( handler->parent->format == kXMP_AVIFile, "only AVI may have multiple top-level chunks", kXMPErr_BadFileFormat );
XMP_Validate( this->containerType == kType_AVIX, "all chunks beyond main chunk must be type AVIX", kXMPErr_BadFileFormat );
}
bool hasSubChunks = ( ( this->id == kChunk_RIFF ) ||
( this->id == kChunk_LIST && this->containerType == kType_INFO ) ||
( this->id == kChunk_LIST && this->containerType == kType_Tdat )
);
XMP_Int64 endOfChunk = this->oldPos + this->oldSize;
if ( (level == 0) && repairMode && (endOfChunk > handler->oldFileSize) )
{
endOfChunk = handler->oldFileSize; // assign actual file size
this->oldSize = endOfChunk - this->oldPos; //reversely calculate correct oldSize
}
XMP_Validate( endOfChunk <= handler->oldFileSize, "offset beyond EoF", kXMPErr_BadFileFormat );
Chunk* curChild = 0;
if ( hasSubChunks )
{
handler->level++;
while ( file->Offset() < endOfChunk )
{
curChild = RIFF::getChunk( this, handler );
if ( file->Offset() % 2 == 1 )
{
XMP_Uns8 pad;
file->Read ( &pad, 1 ); // Read the pad, tolerate being at EOF.
}
if ( (containerType== kType_INFO || containerType == kType_Tdat)
&& ( curChild->chunkType == chunk_JUNK ) )
{
this->children.pop_back();
delete curChild;
} // for other chunks: join neighouring Junk chunks into one
else if ( (curChild->chunkType == chunk_JUNK) && ( this->children.size() >= 2 ) )
{
Chunk* prevChunk = this->children.at( this->children.size() - 2 );
if ( prevChunk->chunkType == chunk_JUNK )
{
prevChunk->oldSize += curChild->oldSize;
prevChunk->newSize += curChild->newSize;
XMP_Enforce( prevChunk->oldSize == prevChunk->newSize );
this->children.pop_back();
delete curChild;
}
}
}
handler->level--;
XMP_Validate( file->Offset() == endOfChunk, "subchunks exceed outer chunk size", kXMPErr_BadFileFormat );
if ( level==1 && this->id==kChunk_LIST && this->containerType == kType_INFO )
handler->listInfoChunk = this;
if ( level==1 && this->id==kChunk_LIST && this->containerType == kType_Tdat )
handler->listTdatChunk = this;
}
else // skip non-interest container chunk
{
file->Seek ( (this->oldSize - 8 - 4), kXMP_SeekFromCurrent );
} // if - else
} // try
catch (XMP_Error& e) {
this->release(); // free resources
if ( this->parent != 0)
this->parent->children.pop_back(); // hereby taken care of, so removing myself...
throw e; // re-throw
}
}
| DoS Overflow | 0 | ContainerChunk::ContainerChunk( ContainerChunk* parent, RIFF_MetaHandler* handler ) : Chunk( parent, handler, false, chunk_CONTAINER )
{
bool repairMode = ( 0 != ( handler->parent->openFlags & kXMPFiles_OpenRepairFile ));
try
{
XMP_IO* file = handler->parent->ioRef;
XMP_Uns8 level = handler->level;
this->containerType = XIO::ReadUns32_LE( file );
if ( level == 0 && handler->riffChunks.size() > 0 )
{
XMP_Validate( handler->parent->format == kXMP_AVIFile, "only AVI may have multiple top-level chunks", kXMPErr_BadFileFormat );
XMP_Validate( this->containerType == kType_AVIX, "all chunks beyond main chunk must be type AVIX", kXMPErr_BadFileFormat );
}
bool hasSubChunks = ( ( this->id == kChunk_RIFF ) ||
( this->id == kChunk_LIST && this->containerType == kType_INFO ) ||
( this->id == kChunk_LIST && this->containerType == kType_Tdat )
);
XMP_Int64 endOfChunk = this->oldPos + this->oldSize;
if ( (level == 0) && repairMode && (endOfChunk > handler->oldFileSize) )
{
endOfChunk = handler->oldFileSize; // assign actual file size
this->oldSize = endOfChunk - this->oldPos; //reversely calculate correct oldSize
}
XMP_Validate( endOfChunk <= handler->oldFileSize, "offset beyond EoF", kXMPErr_BadFileFormat );
Chunk* curChild = 0;
if ( hasSubChunks )
{
handler->level++;
while ( file->Offset() < endOfChunk )
{
curChild = RIFF::getChunk( this, handler );
if ( file->Offset() % 2 == 1 )
{
XMP_Uns8 pad;
file->Read ( &pad, 1 ); // Read the pad, tolerate being at EOF.
}
if ( (containerType== kType_INFO || containerType == kType_Tdat)
&& ( curChild->chunkType == chunk_JUNK ) )
{
this->children.pop_back();
delete curChild;
} // for other chunks: join neighouring Junk chunks into one
else if ( (curChild->chunkType == chunk_JUNK) && ( this->children.size() >= 2 ) )
{
Chunk* prevChunk = this->children.at( this->children.size() - 2 );
if ( prevChunk->chunkType == chunk_JUNK )
{
prevChunk->oldSize += curChild->oldSize;
prevChunk->newSize += curChild->newSize;
XMP_Enforce( prevChunk->oldSize == prevChunk->newSize );
this->children.pop_back();
delete curChild;
}
}
}
handler->level--;
XMP_Validate( file->Offset() == endOfChunk, "subchunks exceed outer chunk size", kXMPErr_BadFileFormat );
if ( level==1 && this->id==kChunk_LIST && this->containerType == kType_INFO )
handler->listInfoChunk = this;
if ( level==1 && this->id==kChunk_LIST && this->containerType == kType_Tdat )
handler->listTdatChunk = this;
}
else // skip non-interest container chunk
{
file->Seek ( (this->oldSize - 8 - 4), kXMP_SeekFromCurrent );
} // if - else
} // try
catch (XMP_Error& e) {
this->release(); // free resources
if ( this->parent != 0)
this->parent->children.pop_back(); // hereby taken care of, so removing myself...
throw e; // re-throw
}
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,888 | JunkChunk::JunkChunk( ContainerChunk* parent, XMP_Int64 size ) : Chunk( parent, chunk_JUNK, kChunk_JUNK )
{
XMP_Assert( size >= 8 );
this->oldSize = size;
this->newSize = size;
this->hasChange = true;
}
| DoS Overflow | 0 | JunkChunk::JunkChunk( ContainerChunk* parent, XMP_Int64 size ) : Chunk( parent, chunk_JUNK, kChunk_JUNK )
{
XMP_Assert( size >= 8 );
this->oldSize = size;
this->newSize = size;
this->hasChange = true;
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,889 | ValueChunk::ValueChunk( ContainerChunk* parent, std::string value, XMP_Uns32 id ) : Chunk( parent, chunk_VALUE, id )
{
this->oldValue = std::string();
this->SetValue( value );
}
| DoS Overflow | 0 | ValueChunk::ValueChunk( ContainerChunk* parent, std::string value, XMP_Uns32 id ) : Chunk( parent, chunk_VALUE, id )
{
this->oldValue = std::string();
this->SetValue( value );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,890 | ValueChunk::ValueChunk( ContainerChunk* parent, RIFF_MetaHandler* handler ) : Chunk( parent, handler, false, chunk_VALUE )
{
XMP_IO* file = handler->parent->ioRef;
XMP_Uns8 level = handler->level;
XMP_Int32 length = (XMP_Int32) this->oldSize - 8;
this->oldValue.reserve( length );
this->oldValue.assign( length + 1, '\0' );
file->ReadAll ( (void*)this->oldValue.data(), length );
this->newValue = this->oldValue;
this->newSize = this->oldSize;
}
| DoS Overflow | 0 | ValueChunk::ValueChunk( ContainerChunk* parent, RIFF_MetaHandler* handler ) : Chunk( parent, handler, false, chunk_VALUE )
{
XMP_IO* file = handler->parent->ioRef;
XMP_Uns8 level = handler->level;
XMP_Int32 length = (XMP_Int32) this->oldSize - 8;
this->oldValue.reserve( length );
this->oldValue.assign( length + 1, '\0' );
file->ReadAll ( (void*)this->oldValue.data(), length );
this->newValue = this->oldValue;
this->newSize = this->oldSize;
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,891 | XMPChunk::XMPChunk( ContainerChunk* parent ) : Chunk( parent, chunk_XMP , kChunk_XMP )
{
}
| DoS Overflow | 0 | XMPChunk::XMPChunk( ContainerChunk* parent ) : Chunk( parent, chunk_XMP , kChunk_XMP )
{
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,892 | XMPChunk::XMPChunk( ContainerChunk* parent, RIFF_MetaHandler* handler ) : Chunk( parent, handler, false, chunk_XMP )
{
chunkType = chunk_XMP;
XMP_IO* file = handler->parent->ioRef;
XMP_Uns8 level = handler->level;
handler->packetInfo.offset = this->oldPos + 8;
handler->packetInfo.length = (XMP_Int32) this->oldSize - 8;
handler->xmpPacket.reserve ( handler->packetInfo.length );
handler->xmpPacket.assign ( handler->packetInfo.length, ' ' );
file->ReadAll ( (void*)handler->xmpPacket.data(), handler->packetInfo.length );
handler->containsXMP = true; // last, after all possible failure
handler->xmpChunk = this;
}
| DoS Overflow | 0 | XMPChunk::XMPChunk( ContainerChunk* parent, RIFF_MetaHandler* handler ) : Chunk( parent, handler, false, chunk_XMP )
{
chunkType = chunk_XMP;
XMP_IO* file = handler->parent->ioRef;
XMP_Uns8 level = handler->level;
handler->packetInfo.offset = this->oldPos + 8;
handler->packetInfo.length = (XMP_Int32) this->oldSize - 8;
handler->xmpPacket.reserve ( handler->packetInfo.length );
handler->xmpPacket.assign ( handler->packetInfo.length, ' ' );
file->ReadAll ( (void*)handler->xmpPacket.data(), handler->packetInfo.length );
handler->containsXMP = true; // last, after all possible failure
handler->xmpChunk = this;
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,893 | void Chunk::changesAndSize( RIFF_MetaHandler* handler )
{
hasChange = false; // unknown chunk ==> no change, naturally
this->newSize = this->oldSize;
}
| DoS Overflow | 0 | void Chunk::changesAndSize( RIFF_MetaHandler* handler )
{
hasChange = false; // unknown chunk ==> no change, naturally
this->newSize = this->oldSize;
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,894 | void ContainerChunk::changesAndSize( RIFF_MetaHandler* handler )
{
bool isRIFFContainer = (this->id == kChunk_RIFF);
bool isLISTContainer = (this->id == kChunk_LIST);
XMP_Enforce ( isRIFFContainer | isLISTContainer );
XMP_Index childIndex; // Could be local to the loops, this simplifies debuging. Need a signed type!
Chunk * currChild;
if ( this->children.empty() ) {
if ( isRIFFContainer) {
this->newSize = 12; // Keep a minimal size container.
} else {
this->newSize = 0; // Will get removed from parent in outer call.
}
this->hasChange = true;
return; // Nothing more to do without children.
}
for ( childIndex = (XMP_Index)this->children.size() - 1; childIndex > 0; --childIndex ) {
currChild = this->children[childIndex];
if ( currChild->chunkType != chunk_JUNK ) continue;
if ( isRIFFContainer ) {
Chunk * prevChild = this->children[childIndex-1];
if ( prevChild->chunkType != chunk_JUNK ) continue;
prevChild->oldSize += currChild->oldSize;
prevChild->newSize += currChild->newSize;
prevChild->hasChange = true;
}
this->children.erase ( this->children.begin() + childIndex );
delete currChild;
this->hasChange = true;
}
for ( childIndex = (XMP_Index)this->children.size() - 1; childIndex >= 0; --childIndex ) {
currChild = this->children[childIndex];
++handler->level;
currChild->changesAndSize ( handler );
--handler->level;
if ( (currChild->newSize == 8) || (currChild->newSize == 0) ) { // ! The newSIze is supposed to include the header.
this->children.erase ( this->children.begin() + childIndex );
delete currChild;
this->hasChange = true;
} else {
this->hasChange |= currChild->hasChange;
currChild->needSizeFix = (currChild->newSize != currChild->oldSize);
if ( currChild->needSizeFix && (currChild->newSize > currChild->oldSize) &&
(this == handler->lastChunk) && (childIndex+1 == (XMP_Index)this->children.size()) ) {
if ( currChild->oldSize != 0 ) currChild->needSizeFix = false;
}
}
}
if ( isRIFFContainer ) {
for ( childIndex = 0; childIndex < (XMP_Index)this->children.size(); ++childIndex ) {
currChild = this->children[childIndex];
if ( ! currChild->needSizeFix ) continue;
currChild->needSizeFix = false;
XMP_Int64 sizeDiff = currChild->newSize - currChild->oldSize; // Positive for growth.
XMP_Uns8 padSize = (currChild->newSize & 1); // Need a pad for odd size.
Chunk * nextChild = 0;
if ( childIndex+1 < (XMP_Index)this->children.size() ) nextChild = this->children[childIndex+1];
if ( (nextChild != 0) && (nextChild->chunkType == chunk_JUNK) ) {
if ( nextChild->newSize >= (9 + sizeDiff + padSize) ) {
nextChild->newSize -= sizeDiff;
nextChild->newSize -= padSize;
nextChild->hasChange = true;
continue;
} else if ( nextChild->newSize == (sizeDiff + padSize) ) {
this->children.erase ( this->children.begin() + childIndex + 1 );
delete nextChild;
continue;
}
}
if ( (sizeDiff + padSize) <= -9 ) {
this->children.insert ( (this->children.begin() + childIndex + 1), new JunkChunk ( NULL, ((-sizeDiff) - padSize) ) );
continue;
}
XMP_Index junkIndex;
Chunk * junkChunk = 0;
for ( junkIndex = 0; junkIndex < (XMP_Index)this->children.size(); ++junkIndex ) {
junkChunk = this->children[junkIndex];
if ( junkChunk->chunkType != chunk_JUNK ) continue;
if ( (junkChunk->newSize >= (9 + currChild->newSize + padSize)) ||
(junkChunk->newSize == (currChild->newSize + padSize)) ) break;
}
if ( junkIndex < (XMP_Index)this->children.size() ) {
if ( junkChunk->newSize == (currChild->newSize + padSize) ) {
this->children[junkIndex] = currChild;
delete junkChunk;
} else {
XMP_Assert ( junkChunk->newSize >= (9 + currChild->newSize + padSize) );
junkChunk->newSize -= (currChild->newSize + padSize);
junkChunk->hasChange = true;
this->children.insert ( (this->children.begin() + junkIndex), currChild );
if ( junkIndex < childIndex ) ++childIndex; // The insertion moved the current child.
}
if ( currChild->oldSize != 0 ) {
this->children[childIndex] = new JunkChunk ( 0, currChild->oldSize ); // Replace the old space with junk.
} else {
this->children.erase ( this->children.begin() + childIndex ); // Remove the newly created chunk's old location.
--childIndex; // Make the next loop iteration not skip a chunk.
}
continue;
}
bool isListInfo = (currChild->id == kChunk_LIST) && (currChild->chunkType == chunk_CONTAINER) &&
(((ContainerChunk*)currChild)->containerType == kType_INFO);
if ( isListInfo && (handler->riffChunks.size() > 1) &&
(this->id == kChunk_RIFF) && (this != handler->lastChunk) ) {
if ( currChild->oldSize != 0 ) {
this->children[childIndex] = new JunkChunk ( 0, currChild->oldSize );
} else {
this->children.erase ( this->children.begin() + childIndex );
--childIndex; // Make the next loop iteration not skip a chunk.
}
delete currChild;
continue;
}
if ( (this == handler->lastChunk) && (childIndex+1 == (XMP_Index)this->children.size()) ) continue; // Already last.
handler->lastChunk->children.push_back( currChild );
if ( currChild->oldSize != 0 ) {
this->children[childIndex] = new JunkChunk ( 0, currChild->oldSize ); // Replace the old space with junk.
} else {
this->children.erase ( this->children.begin() + childIndex ); // Remove the newly created chunk's old location.
--childIndex; // Make the next loop iteration not skip a chunk.
}
}
}
this->newSize = 12; // Start with standard container header.
for ( childIndex = 0; childIndex < (XMP_Index)this->children.size(); ++childIndex ) {
currChild = this->children[childIndex];
this->newSize += currChild->newSize;
this->newSize += (this->newSize & 1); // Round up if odd.
}
XMP_Validate ( (this->newSize <= 0xFFFFFFFFLL), "No single chunk may be above 4 GB", kXMPErr_Unimplemented );
}
| DoS Overflow | 0 | void ContainerChunk::changesAndSize( RIFF_MetaHandler* handler )
{
bool isRIFFContainer = (this->id == kChunk_RIFF);
bool isLISTContainer = (this->id == kChunk_LIST);
XMP_Enforce ( isRIFFContainer | isLISTContainer );
XMP_Index childIndex; // Could be local to the loops, this simplifies debuging. Need a signed type!
Chunk * currChild;
if ( this->children.empty() ) {
if ( isRIFFContainer) {
this->newSize = 12; // Keep a minimal size container.
} else {
this->newSize = 0; // Will get removed from parent in outer call.
}
this->hasChange = true;
return; // Nothing more to do without children.
}
for ( childIndex = (XMP_Index)this->children.size() - 1; childIndex > 0; --childIndex ) {
currChild = this->children[childIndex];
if ( currChild->chunkType != chunk_JUNK ) continue;
if ( isRIFFContainer ) {
Chunk * prevChild = this->children[childIndex-1];
if ( prevChild->chunkType != chunk_JUNK ) continue;
prevChild->oldSize += currChild->oldSize;
prevChild->newSize += currChild->newSize;
prevChild->hasChange = true;
}
this->children.erase ( this->children.begin() + childIndex );
delete currChild;
this->hasChange = true;
}
for ( childIndex = (XMP_Index)this->children.size() - 1; childIndex >= 0; --childIndex ) {
currChild = this->children[childIndex];
++handler->level;
currChild->changesAndSize ( handler );
--handler->level;
if ( (currChild->newSize == 8) || (currChild->newSize == 0) ) { // ! The newSIze is supposed to include the header.
this->children.erase ( this->children.begin() + childIndex );
delete currChild;
this->hasChange = true;
} else {
this->hasChange |= currChild->hasChange;
currChild->needSizeFix = (currChild->newSize != currChild->oldSize);
if ( currChild->needSizeFix && (currChild->newSize > currChild->oldSize) &&
(this == handler->lastChunk) && (childIndex+1 == (XMP_Index)this->children.size()) ) {
if ( currChild->oldSize != 0 ) currChild->needSizeFix = false;
}
}
}
if ( isRIFFContainer ) {
for ( childIndex = 0; childIndex < (XMP_Index)this->children.size(); ++childIndex ) {
currChild = this->children[childIndex];
if ( ! currChild->needSizeFix ) continue;
currChild->needSizeFix = false;
XMP_Int64 sizeDiff = currChild->newSize - currChild->oldSize; // Positive for growth.
XMP_Uns8 padSize = (currChild->newSize & 1); // Need a pad for odd size.
Chunk * nextChild = 0;
if ( childIndex+1 < (XMP_Index)this->children.size() ) nextChild = this->children[childIndex+1];
if ( (nextChild != 0) && (nextChild->chunkType == chunk_JUNK) ) {
if ( nextChild->newSize >= (9 + sizeDiff + padSize) ) {
nextChild->newSize -= sizeDiff;
nextChild->newSize -= padSize;
nextChild->hasChange = true;
continue;
} else if ( nextChild->newSize == (sizeDiff + padSize) ) {
this->children.erase ( this->children.begin() + childIndex + 1 );
delete nextChild;
continue;
}
}
if ( (sizeDiff + padSize) <= -9 ) {
this->children.insert ( (this->children.begin() + childIndex + 1), new JunkChunk ( NULL, ((-sizeDiff) - padSize) ) );
continue;
}
XMP_Index junkIndex;
Chunk * junkChunk = 0;
for ( junkIndex = 0; junkIndex < (XMP_Index)this->children.size(); ++junkIndex ) {
junkChunk = this->children[junkIndex];
if ( junkChunk->chunkType != chunk_JUNK ) continue;
if ( (junkChunk->newSize >= (9 + currChild->newSize + padSize)) ||
(junkChunk->newSize == (currChild->newSize + padSize)) ) break;
}
if ( junkIndex < (XMP_Index)this->children.size() ) {
if ( junkChunk->newSize == (currChild->newSize + padSize) ) {
this->children[junkIndex] = currChild;
delete junkChunk;
} else {
XMP_Assert ( junkChunk->newSize >= (9 + currChild->newSize + padSize) );
junkChunk->newSize -= (currChild->newSize + padSize);
junkChunk->hasChange = true;
this->children.insert ( (this->children.begin() + junkIndex), currChild );
if ( junkIndex < childIndex ) ++childIndex; // The insertion moved the current child.
}
if ( currChild->oldSize != 0 ) {
this->children[childIndex] = new JunkChunk ( 0, currChild->oldSize ); // Replace the old space with junk.
} else {
this->children.erase ( this->children.begin() + childIndex ); // Remove the newly created chunk's old location.
--childIndex; // Make the next loop iteration not skip a chunk.
}
continue;
}
bool isListInfo = (currChild->id == kChunk_LIST) && (currChild->chunkType == chunk_CONTAINER) &&
(((ContainerChunk*)currChild)->containerType == kType_INFO);
if ( isListInfo && (handler->riffChunks.size() > 1) &&
(this->id == kChunk_RIFF) && (this != handler->lastChunk) ) {
if ( currChild->oldSize != 0 ) {
this->children[childIndex] = new JunkChunk ( 0, currChild->oldSize );
} else {
this->children.erase ( this->children.begin() + childIndex );
--childIndex; // Make the next loop iteration not skip a chunk.
}
delete currChild;
continue;
}
if ( (this == handler->lastChunk) && (childIndex+1 == (XMP_Index)this->children.size()) ) continue; // Already last.
handler->lastChunk->children.push_back( currChild );
if ( currChild->oldSize != 0 ) {
this->children[childIndex] = new JunkChunk ( 0, currChild->oldSize ); // Replace the old space with junk.
} else {
this->children.erase ( this->children.begin() + childIndex ); // Remove the newly created chunk's old location.
--childIndex; // Make the next loop iteration not skip a chunk.
}
}
}
this->newSize = 12; // Start with standard container header.
for ( childIndex = 0; childIndex < (XMP_Index)this->children.size(); ++childIndex ) {
currChild = this->children[childIndex];
this->newSize += currChild->newSize;
this->newSize += (this->newSize & 1); // Round up if odd.
}
XMP_Validate ( (this->newSize <= 0xFFFFFFFFLL), "No single chunk may be above 4 GB", kXMPErr_Unimplemented );
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,895 | void XMPChunk::changesAndSize( RIFF_MetaHandler* handler )
{
XMP_Enforce( &handler->xmpPacket != 0 );
XMP_Enforce( handler->xmpPacket.size() > 0 );
this->newSize = 8 + handler->xmpPacket.size();
XMP_Validate( this->newSize <= 0xFFFFFFFFLL, "no single chunk may be above 4 GB", kXMPErr_InternalFailure );
this->hasChange = true;
}
| DoS Overflow | 0 | void XMPChunk::changesAndSize( RIFF_MetaHandler* handler )
{
XMP_Enforce( &handler->xmpPacket != 0 );
XMP_Enforce( handler->xmpPacket.size() > 0 );
this->newSize = 8 + handler->xmpPacket.size();
XMP_Validate( this->newSize <= 0xFFFFFFFFLL, "no single chunk may be above 4 GB", kXMPErr_InternalFailure );
this->hasChange = true;
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,896 | void ValueChunk::changesAndSize( RIFF_MetaHandler* handler )
{
if ( this->newValue.size() != this->oldValue.size() ) {
this->hasChange = true;
} else if ( strncmp ( this->oldValue.c_str(), this->newValue.c_str(), this->newValue.size() ) != 0 ) {
this->hasChange = true;
}
}
| DoS Overflow | 0 | void ValueChunk::changesAndSize( RIFF_MetaHandler* handler )
{
if ( this->newValue.size() != this->oldValue.size() ) {
this->hasChange = true;
} else if ( strncmp ( this->oldValue.c_str(), this->newValue.c_str(), this->newValue.size() ) != 0 ) {
this->hasChange = true;
}
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,897 | void JunkChunk::changesAndSize( RIFF_MetaHandler* handler )
{
this->newSize = this->oldSize; // optimization at a later stage
XMP_Validate( this->newSize <= 0xFFFFFFFFLL, "no single chunk may be above 4 GB", kXMPErr_InternalFailure );
if ( this->id == kChunk_JUNQ ) this->hasChange = true; // Force ID change to JUNK.
}
| DoS Overflow | 0 | void JunkChunk::changesAndSize( RIFF_MetaHandler* handler )
{
this->newSize = this->oldSize; // optimization at a later stage
XMP_Validate( this->newSize <= 0xFFFFFFFFLL, "no single chunk may be above 4 GB", kXMPErr_InternalFailure );
if ( this->id == kChunk_JUNQ ) this->hasChange = true; // Force ID change to JUNK.
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,898 | chunkVectIter ContainerChunk::getChild( Chunk* needle )
{
chunkVectIter iter;
for( iter = this->children.begin(); iter != this->children.end(); iter++ )
{
Chunk* temp1 = *iter;
Chunk* temp2 = needle;
if ( (*iter) == needle ) return iter;
}
return this->children.end();
}
| DoS Overflow | 0 | chunkVectIter ContainerChunk::getChild( Chunk* needle )
{
chunkVectIter iter;
for( iter = this->children.begin(); iter != this->children.end(); iter++ )
{
Chunk* temp1 = *iter;
Chunk* temp2 = needle;
if ( (*iter) == needle ) return iter;
}
return this->children.end();
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
12,899 | void ContainerChunk::release()
{
Chunk* curChunk;
while( ! this->children.empty() )
{
curChunk = this->children.back();
delete curChunk;
this->children.pop_back();
}
}
| DoS Overflow | 0 | void ContainerChunk::release()
{
Chunk* curChunk;
while( ! this->children.empty() )
{
curChunk = this->children.back();
delete curChunk;
this->children.pop_back();
}
}
| @@ -167,7 +167,8 @@ Chunk::Chunk( ContainerChunk* parent, RIFF_MetaHandler* handler, bool skip, Chun
this->oldPos = file->Offset();
this->id = XIO::ReadUns32_LE( file );
- this->oldSize = XIO::ReadUns32_LE( file ) + 8;
+ this->oldSize = XIO::ReadUns32_LE( file );
+ this->oldSize += 8;
// Make sure the size is within expected bounds.
XMP_Int64 chunkEnd = this->oldPos + this->oldSize; | CWE-190 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.