diff --git a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp index 0059d578c1..4597d7e3f5 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp +++ b/ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp @@ -1259,7 +1259,7 @@ namespace DocFileFormat { //it's a bitmap image BitmapBlip* bitBlip = static_cast(RecordFactory::ReadRecord(&reader, 0)); - if (bitBlip) + if ((bitBlip) && (bitBlip->m_pvBits)) { m_ctx->_docx->ImagesList.push_back(ImageFileStructure(GetTargetExt(oBlip->btWin32), vector(bitBlip->m_pvBits, (bitBlip->m_pvBits + bitBlip->pvBitsSize)), oBlip->btWin32)); diff --git a/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h b/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h index 4c7c7739a1..2440fd4d9e 100644 --- a/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h +++ b/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h @@ -27,7 +27,7 @@ public: { unsigned short rdUShort = 0; - if ( stream != NULL ) + if ( (stream != NULL) && (position + 2 < stream->size())) { stream->seek( position ); stream->read((unsigned char*)(&rdUShort), sizeof( rdUShort )); @@ -42,7 +42,7 @@ public: { short rdShort = 0; - if ( stream != NULL ) + if ( (stream != NULL) && (position + 2 < stream->size())) { stream->seek( position ); stream->read((unsigned char*)(&rdShort), sizeof( rdShort )); @@ -57,7 +57,7 @@ public: { int rdInt = 0; - if ( stream != NULL ) + if ( (stream != NULL) && (position + 4 < stream->size())) { stream->seek( position ); stream->read( (unsigned char*) &rdInt, sizeof( rdInt ) ); @@ -72,7 +72,7 @@ public: { int rdUInt = 0; - if ( stream != NULL ) + if ( (stream != NULL) && (position + 4 < stream->size())) { stream->seek( position ); stream->read((unsigned char*) &rdUInt, sizeof( rdUInt ) ); @@ -87,7 +87,7 @@ public: { unsigned char rdByte = 0; - if ( this->stream != NULL ) + if ( (stream != NULL) && (position + 1 < stream->size())) { stream->seek( position); stream->read( (unsigned char*)&rdByte, sizeof( rdByte ) ); @@ -102,7 +102,7 @@ public: { unsigned char *rdBytes = NULL; - if ( ( stream != NULL ) && ( count > 0 ) ) + if ( ( stream != NULL ) && ( count > 0 ) && (position + count < stream->size())) { rdBytes = new unsigned char[count]; @@ -221,7 +221,6 @@ public: private: - POLE::uint64 position; - //std::streampos position; + POLE::uint64 position; POLE::Stream* stream; };