diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-11-16 15:02:35 +0300 |
---|---|---|
committer | Xisco FaulĂ <xiscofauli@libreoffice.org> | 2019-11-20 17:09:08 +0100 |
commit | d54bae3471e9b9529f1ac03c811c3370d9f5ed89 (patch) | |
tree | c549da9b6546364050332f4997709af875b481f2 /sax | |
parent | 3073a6de85d5d7fd8837d1ae25306d03e857f8d7 (diff) |
tdf#128820: use wps namespace for simple text shapes
Without that, simple text shapes inside groups were written in
<pic:wsp> elements, with many child elements also having pic::
prefix.
Change-Id: I114cf3499e03aa5ca042211d7b134aaf5b0e7fbf
Reviewed-on: https://gerrit.libreoffice.org/82980
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Also consider saved exceptions when terminating parse
As with previous commit 18ae77a065cb8ae6940d4067f6ab7e99a3f74047, this
will start showing parse errors on invalid files which previously just
opened without warnings, silently losing the invalid stream part. Any
bug bisected to this commit is not a regression from this commit! The
real problem was already before, and was just disclosed by this (which
is the actual goal).
Also simplify unit test data for tdf#128820, which will now be enough
after the change.
A unit test (testN779627) revealed unexpected throws when parsing; this
was fixed.
Change-Id: I5a21b9001874ec6e3b8273c10043ef930bf1cc82
Reviewed-on: https://gerrit.libreoffice.org/82981
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
tdf#128820: improve unit test to not depend on opening bad file failing
... also test exported XML directly
Change-Id: I50237593dd111e7c7974452769c8d49c22012713
Reviewed-on: https://gerrit.libreoffice.org/83005
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Fix UBSan build after 9fdf8c0a5cc036ea9bd1e11dd8f2c1a6e601fae2
The said commit simplified a testdoc to testTdf128820, using a smallest
possible SVG in it. This seems to produce the smallest possible PNG of
size 8, which is passed into GraphicDescriptor::ImpDetectPNG. There its
size is read into nTemp32 past the end of the file without checks,
which keeps last value of the variable (which was the magic number
0x0d0a1a0a), which is then saved into the descriptor. Then that value
is used in ImpGraphic::ImplGetSizePixel, and later multiplying it in
lclConvertScreenPixelToHmm causes UB.
Fix by checking all the reads in GraphicDescriptor::ImpDetectPNG.
Change-Id: Ib4740fac2b87fbef57d5150151129b9852f3ecb8
Reviewed-on: https://gerrit.libreoffice.org/83119
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/83296
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 7383b8c339ea..9b35c1682be5 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -175,6 +175,8 @@ struct Entity : public ParserData css::uno::Any maSavedException; osl::Mutex maSavedExceptionMutex; void saveException( const Any & e ); + // Thread-safe check if maSavedException has value + bool hasException(); void throwException( const ::rtl::Reference< FastLocatorImpl > &xDocumentLocator, bool mbDuringParse ); @@ -622,6 +624,12 @@ void Entity::saveException( const Any & e ) } } +bool Entity::hasException() +{ + osl::MutexGuard g(maSavedExceptionMutex); + return maSavedException.hasValue(); +} + } // namespace namespace sax_fastparser { @@ -1040,6 +1048,8 @@ void FastSaxParserImpl::parse() { if( xmlParseChunk( rEntity.mpParser, reinterpret_cast<const char*>(seqOut.getConstArray()), 0, 1 ) != XML_ERR_OK ) rEntity.throwException( mxDocumentLocator, true ); + if (rEntity.hasException()) + rEntity.throwException(mxDocumentLocator, true); } break; } @@ -1068,10 +1078,8 @@ void FastSaxParserImpl::parse() { rEntity.throwException( mxDocumentLocator, true ); } - osl::ClearableMutexGuard g(rEntity.maSavedExceptionMutex); - if (rEntity.maSavedException.hasValue()) + if (rEntity.hasException()) { - g.clear(); rEntity.throwException( mxDocumentLocator, true ); } } while( nRead > 0 ); |