Commit c880c489 authored by Hubert Figuiere's avatar Hubert Figuiere
Browse files

Merge tag 'v2021.10' into adobe-sdk

parents 77a3fe70 a3c57885
......@@ -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
......
......@@ -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;
}
}
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment