summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHubert Figuière <hub@figuiere.net>2022-02-12 18:37:04 -0500
committerHubert Figuière <hub@figuiere.net>2022-02-12 18:37:04 -0500
commitc880c48907effd02e2d0e351719584034a861241 (patch)
treecf69ad7c2938287a8772fbc3ef62de3199188b8d
parent77a3fe7096f8ebf301e2bfe1e6dc023b4ff6dc48 (diff)
parenta3c578859d0c6f6388059f7d6667a266647ef612 (diff)
Merge tag 'v2021.10' into adobe-sdkadobe-sdk
-rw-r--r--XMPFiles/source/FileHandlers/SVG_Handler.cpp12
-rw-r--r--XMPFiles/source/FormatSupport/SVG_Adapter.cpp2
-rw-r--r--XMPFiles/source/FormatSupport/WAVE/WAVEBehavior.cpp3
3 files changed, 11 insertions, 6 deletions
diff --git a/XMPFiles/source/FileHandlers/SVG_Handler.cpp b/XMPFiles/source/FileHandlers/SVG_Handler.cpp
index 029c8ad..5165bb1 100644
--- a/XMPFiles/source/FileHandlers/SVG_Handler.cpp
+++ b/XMPFiles/source/FileHandlers/SVG_Handler.cpp
@@ -598,7 +598,7 @@ void SVG_MetaHandler::CacheFileData()
{
XMP_Int64 trailerOffset = svgAdapter->GetPIOffset( "xpacket", 2 );
XML_NodePtr trailerNode = metadataNode->GetNamedElement( "", "xpacket", 1 );
- if ( trailerOffset != -1 || trailerNode != 0 )
+ if (trailerOffset != -1 && trailerNode != 0)
{
packetLength = 2; // "<?" = 2
packetLength += trailerNode->name.length(); // Node's name
@@ -712,7 +712,8 @@ void SVG_MetaHandler::ProcessTitle( XMP_IO* sourceRef, XMP_IO * destRef, const s
}
else
{
- char tempStr[1024];
+ char *tempStr = new char[titleOffset.endOffset - titleOffset.startOffset + 1];
+
tempStr [titleOffset.endOffset - titleOffset.startOffset] = '\0';
if(sourceRef != NULL) {
@@ -732,6 +733,8 @@ void SVG_MetaHandler::ProcessTitle( XMP_IO* sourceRef, XMP_IO * destRef, const s
destRef->Write( value.c_str(), static_cast< int >( value.length() ) );
currentOffset = titleOffset.endOffset;
+ delete[] tempStr;
+ tempStr = NULL;
}
} // SVG_MetaHandler::ProcessTitle
@@ -751,7 +754,8 @@ void SVG_MetaHandler::ProcessDescription( XMP_IO* sourceRef, XMP_IO * destRef, c
}
else
{
- char tempStr[1024];
+ char *tempStr = new char[descOffset.endOffset - descOffset.startOffset + 1];
+
tempStr [descOffset.endOffset - descOffset.startOffset] = '\0';
if(sourceRef != NULL) {
sourceRef->Seek(descOffset.startOffset, kXMP_SeekFromStart);
@@ -768,6 +772,8 @@ void SVG_MetaHandler::ProcessDescription( XMP_IO* sourceRef, XMP_IO * destRef, c
}
destRef->Write( value.c_str(), static_cast< int >( value.length() ) );
currentOffset = descOffset.endOffset;
+ delete[] tempStr;
+ tempStr = NULL;
}
} // SVG_MetaHandler::ProcessDescription
diff --git a/XMPFiles/source/FormatSupport/SVG_Adapter.cpp b/XMPFiles/source/FormatSupport/SVG_Adapter.cpp
index 9907b9a..0607c45 100644
--- a/XMPFiles/source/FormatSupport/SVG_Adapter.cpp
+++ b/XMPFiles/source/FormatSupport/SVG_Adapter.cpp
@@ -134,7 +134,7 @@ XMP_Int64 SVG_Adapter::GetPIOffset( std::string PIName, XMP_Uns32 requiredIndex
XMP_Uns32 index = 0;
IteratorStringXMP_Int64 indexIterator = iterator.first;
for ( ; index < ( requiredIndex - 1 ) && indexIterator != iterator.second; ++indexIterator, ++index );
- if ( index == requiredIndex - 1 )
+ if ( indexIterator != this->mPIWithOffsetMap.end() && index == requiredIndex - 1 )
return indexIterator->second;
}
}
diff --git a/XMPFiles/source/FormatSupport/WAVE/WAVEBehavior.cpp b/XMPFiles/source/FormatSupport/WAVE/WAVEBehavior.cpp
index 0ef50e6..0c39b8a 100644
--- a/XMPFiles/source/FormatSupport/WAVE/WAVEBehavior.cpp
+++ b/XMPFiles/source/FormatSupport/WAVE/WAVEBehavior.cpp
@@ -608,11 +608,10 @@ bool WAVEBehavior::parseDS64Chunk( const Chunk& ds64Chunk, WAVEBehavior::DS64& d
memcpy( &ds64, data, kMinimumDS64ChunkSize );
// If there is more data but the table length is <= 0 then this is not a valid ds64 chunk
- if( size > kMinimumDS64ChunkSize && ds64.tableLength > 0 )
+ if (size > kMinimumDS64ChunkSize && ds64.tableLength > 0 && ((size - kMinimumDS64ChunkSize) >= (ds64.tableLength * sizeof(ChunkSize64))))
{
// copy chunk sizes table
//
- XMP_Assert( size - kMinimumDS64ChunkSize >= ds64.tableLength * sizeof(ChunkSize64));
XMP_Uns32 offset = kMinimumDS64ChunkSize;
ChunkSize64 chunkSize;