From 3590487f9cd1475442a6cb25ff7ed98543f25623 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Thu, 21 Apr 2016 14:40:03 +0300 Subject: [PATCH] . --- .../DocDocxConverter/VirtualStreamReader.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h b/ASCOfficeDocFile/DocDocxConverter/VirtualStreamReader.h index f7030329d4..db41f7beec 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 ) && isResultNeeded ) + if ( ( stream != NULL ) && ( count > 0 )) { rdBytes = new unsigned char[count]; @@ -114,10 +114,6 @@ public: position += sizeof( unsigned char )*count; } } - else - { - position += sizeof( unsigned char )*count; - } return rdBytes; } @@ -225,7 +221,6 @@ public: private: - POLE::uint64 position; - //std::streampos position; + POLE::uint64 position; POLE::Stream* stream; };