[Libreoffice-commits] core.git: tools/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 21 17:19:47 UTC 2019
tools/source/stream/stream.cxx | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
New commits:
commit b25fd58a1ecba62f7967dd118194f5994fcd5c23
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Mon Oct 21 15:34:44 2019 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Mon Oct 21 19:18:25 2019 +0200
-fsanitize=nullptr-with-nonzero-offset
...(new with Clang 10 trunk), as seen during CppunitTest_emfio_wmf:
> tools/source/stream/stream.cxx:808:32: runtime error: applying non-zero offset 10 to null pointer
> #0 in SvStream::SeekRel(long) at tools/source/stream/stream.cxx:808:32
> #1 in (anonymous namespace)::ImplReadDIBFileHeader(SvStream&, unsigned long&) at vcl/source/gdi/dibtools.cxx:1085:19
> #2 in (anonymous namespace)::ImplReadDIB(Bitmap&, AlphaMask*, SvStream&, bool, bool, bool) at vcl/source/gdi/dibtools.cxx:1656:12
> #3 in ReadDIB(Bitmap&, SvStream&, bool, bool) at vcl/source/gdi/dibtools.cxx:1738:12
> #4 in emfio::EmfReader::ReadEnhWMF() at emfio/source/reader/emfreader.cxx:1507:33
> #5 in emfio::emfreader::XEmfParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at emfio/source/emfuno/xemfparser.cxx:148:72
> #6 in non-virtual thunk to emfio::emfreader::XEmfParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) at emfio/source/emfuno/xemfparser.cxx
> #7 in VectorGraphicData::ensureSequenceAndRange() at vcl/source/gdi/vectorgraphicdata.cxx:172:137
> #8 in VectorGraphicData::getPrimitive2DSequence() const at vcl/source/gdi/vectorgraphicdata.cxx:279:45
> #9 in ImpGraphic::ImplGetGDIMetaFile() const at vcl/source/gdi/impgraph.cxx:844:110
> #10 in Graphic::GetGDIMetaFile() const at vcl/source/gdi/graph.cxx:365:26
> #11 in ReadWindowMetafile(SvStream&, GDIMetaFile&) at vcl/source/filter/wmf/wmf.cxx:62:25
> #12 in WmfTest::testEmfProblem() at emfio/qa/cppunit/wmf/wmfimporttest.cxx:116:5
An invariant of SvStream appears to be that m_pRWBuf can be null and that
m_pBufPos is null iff m_pRWBuf is null. So don't update m_pBufPos here when
m_pRWBuf is null. (And assert the assumed invariant.)
Change-Id: Iad2eb2723394f5564d43dfa8a3a1a8b8de79158d
Reviewed-on: https://gerrit.libreoffice.org/81237
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 713d36504b6f..c10dad0457fa 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -19,6 +19,9 @@
// TODO: Read->RefreshBuffer-> React to changes from m_nBufActualLen
+#include <sal/config.h>
+
+#include <cassert>
#include <cstddef>
#include <memory>
@@ -805,7 +808,11 @@ sal_uInt64 SvStream::SeekRel(sal_Int64 const nPos)
nActualPos -= nAbsPos;
}
- m_pBufPos = m_pRWBuf.get() + nActualPos;
+ assert((m_pBufPos != nullptr) == bool(m_pRWBuf));
+ if (m_pRWBuf)
+ {
+ m_pBufPos = m_pRWBuf.get() + nActualPos;
+ }
return Seek( nActualPos );
}
More information about the Libreoffice-commits
mailing list