From fa5dffd7149661850bb27ea0b2d24de06d38a6bc Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 30 Nov 2011 16:06:18 +0100 Subject: svtools: ImpPeekGraphicFormat: STL assertion --- svtools/source/filter/filter.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'svtools') diff --git a/svtools/source/filter/filter.cxx b/svtools/source/filter/filter.cxx index a4202039922b..ef07514285df 100644 --- a/svtools/source/filter/filter.cxx +++ b/svtools/source/filter/filter.cxx @@ -249,9 +249,14 @@ static sal_Bool ImpPeekGraphicFormat( SvStream& rStream, String& rFormatExtensio nStreamLen = rStream.Tell() - nStreamPos; rStream.Seek( nStreamPos ); } - // Die ersten 256 Bytes in einen Buffer laden: - if( nStreamLen >= 256 ) + if (!nStreamLen) + { + return false; // this prevents at least a STL assertion + } + else if (nStreamLen >= 256) + { // load first 256 bytes into a buffer rStream.Read( sFirstBytes, 256 ); + } else { rStream.Read( sFirstBytes, nStreamLen ); -- cgit