diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-07-11 22:00:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-07-11 22:00:13 +0100 |
commit | 6c4edabf3e4ae1723d2eebb1006a4843a202706c (patch) | |
tree | 3cb3663636b22db9ce1ba1f5259d13814e434f26 /filter | |
parent | callcatcher: remove various unused save, etc. methods (diff) | |
download | core-6c4edabf3e4ae1723d2eebb1006a4843a202706c.tar.gz core-6c4edabf3e4ae1723d2eebb1006a4843a202706c.zip |
avoid optimization turning into pessimisation for stupid strings
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 7ea6163b2ae5..c0b10b85e9b2 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -609,7 +609,10 @@ bool DffPropSet::GetPropertyBool( sal_uInt32 nId, bool bDefault ) const if( (nBufferSize > 0) && SeekToContent( nId, rStrm ) ) { sal_Int32 nStrLen = static_cast< sal_Int32 >( nBufferSize / 2 ); - aBuffer.ensureCapacity( nStrLen ); + //clip initial size of buffer to something sane in case of silly length + //strings. If there really is a silly amount of data available it still + //works out ok of course + aBuffer.ensureCapacity(std::min(nStrLen,static_cast<sal_Int32>(8192))); for( sal_Int32 nCharIdx = 0; nCharIdx < nStrLen; ++nCharIdx ) { sal_uInt16 nChar = 0; |