summaryrefslogtreecommitdiff
path: root/XMPFiles/source/FileHandlers/SWF_Handler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'XMPFiles/source/FileHandlers/SWF_Handler.cpp')
-rw-r--r--XMPFiles/source/FileHandlers/SWF_Handler.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/XMPFiles/source/FileHandlers/SWF_Handler.cpp b/XMPFiles/source/FileHandlers/SWF_Handler.cpp
index 9a7443f..8ca52de 100644
--- a/XMPFiles/source/FileHandlers/SWF_Handler.cpp
+++ b/XMPFiles/source/FileHandlers/SWF_Handler.cpp
@@ -141,6 +141,7 @@ void SWF_MetaHandler::CacheFileData() {
// Look for the FileAttributes and Metadata tags.
+ if(this->expandedSize <= SWF_IO::HeaderPrefixSize ) return; // Throw?
this->firstTagOffset = SWF_IO::FileHeaderSize ( this->expandedSWF[SWF_IO::HeaderPrefixSize] );
XMP_Uns32 currOffset = this->firstTagOffset;
@@ -237,6 +238,9 @@ void SWF_MetaHandler::UpdateFile ( bool doSafeUpdate )
PutUns16LE ( ((SWF_IO::FileAttributesTagID << 6) | 4), &buffer[0] );
PutUns32LE ( SWF_IO::HasMetadataMask, &buffer[2] );
+ if(this->expandedSWF.size() < this->firstTagOffset ){
+ XMP_Throw ( "Index not valid.Invalid SWF, can't update.", kXMPErr_BadIndex );
+ }
this->expandedSWF.insert ( (this->expandedSWF.begin() + this->firstTagOffset), 6, 0 );
memcpy ( &this->expandedSWF[this->firstTagOffset], &buffer[0], 6 );
@@ -270,6 +274,9 @@ void SWF_MetaHandler::UpdateFile ( bool doSafeUpdate )
this->metadataTag.tagOffset += attrTagLength; // The FileAttributes tag will become in front.
}
+ if(this->expandedSWF.size() < this->firstTagOffset ){
+ XMP_Throw ( "Index not valid.Invalid SWF, can't update.", kXMPErr_BadIndex );
+ }
this->expandedSWF.insert ( (this->expandedSWF.begin() + this->firstTagOffset), attrTagLength, 0 );
memcpy ( &this->expandedSWF[this->firstTagOffset], &attrTag[0], attrTagLength );
@@ -300,6 +307,9 @@ void SWF_MetaHandler::UpdateFile ( bool doSafeUpdate )
this->metadataTag.contentLength = (XMP_Uns32)this->xmpPacket.size();
XMP_Uns32 newMetaLength = 6 + this->metadataTag.contentLength; // Always use a long tag header.
+ if(this->expandedSWF.size() < this->metadataTag.tagOffset ){
+ XMP_Throw ( "Index not valid.Invalid SWF, can't update.", kXMPErr_BadIndex );
+ }
this->expandedSWF.insert ( (this->expandedSWF.begin() + this->metadataTag.tagOffset), newMetaLength, 0 );
PutUns16LE ( ((SWF_IO::MetadataTagID << 6) | SWF_IO::TagLengthMask), &this->expandedSWF[this->metadataTag.tagOffset] );