office-gobmx/sdext
Stephan Bergmann 12362fc496 LineParser::readNextToken gets called with m_nCharIndex==npos after all
eca89ece45 "Replace rtl_string_getTokenView with
o3tl::getToken" had erroneously assumed (from a succeeding `make check`) that
the only problematic call to o3tl::getToken with position==npos would be the one
in LineParser::readPath (and which had been addressed in that commit).

But e.g. loading ooo29794-4.pdf from the crash test corpus would also run into
that situation via LineParser::readNextToken,

> warn:legacy.osl:3090875:3090875:sdext/source/pdfimport/wrapper/wrapper.cxx:259: insufficient input
> soffice.bin: include/o3tl/string_view.hxx:34: std::string_view o3tl::getToken(std::string_view, char, std::size_t &): Assertion `position <= sv.size()' failed.

> #3  0x00007ffff7a67a16 in __GI___assert_fail (assertion=0x7fffb39ea58c "position <= sv.size()", file=0x7fffb39f2a7f "include/o3tl/string_view.hxx", line=34, function=0x7fffb39ef3a9 "std::string_view o3tl::getToken(std::string_view, char, std::size_t &)")
> #4  0x00007fffb3b60131 in o3tl::getToken(std::basic_string_view<char, std::char_traits<char> >, char, unsigned long&) (sv="eoClipPath", delimiter=32 ' ', position=@0x7fffffff29e0: 18446744073709551615) at include/o3tl/string_view.hxx:34
> #5  0x00007fffb3b5aa9f in pdfi::(anonymous namespace)::LineParser::readNextToken() (this=0x7fffffff29d0) at sdext/source/pdfimport/wrapper/wrapper.cxx:260
> #6  0x00007fffb3b5b2fa in pdfi::(anonymous namespace)::LineParser::readPath() (this=0x7fffffff29d0) at sdext/source/pdfimport/wrapper/wrapper.cxx:323
> #7  0x00007fffb3b59eb3 in pdfi::(anonymous namespace)::Parser::parseLine(rtl::OString const&) (this=0x7fffffff2d28, rLine="eoClipPath") at sdext/source/pdfimport/wrapper/wrapper.cxx:859
[...]

so better guard there.

Change-Id: Ibfd53fd9d3be0a3548d60cb26d59bb5966c5bc2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115916
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-05-21 14:50:14 +02:00
..
inc update PCHs 2021-04-08 17:23:08 +02:00
source LineParser::readNextToken gets called with m_nCharIndex==npos after all 2021-05-21 14:50:14 +02:00
CppunitTest_sdext_pdfimport.mk
CustomTarget_pdfimport.mk GBUILD_TRACE, support for finding out where the build time is spent 2020-02-16 14:49:45 +01:00
Executable_pdf2xml.mk
Executable_pdfunzip.mk
Executable_xpdfimport.mk
IwyuFilter_sdext.yaml replace usage of blacklist with excludelist for IWYU 2020-07-10 02:03:40 +02:00
Library_pdfimport.mk sdext/pdfimport: create instances with uno constructors 2020-07-16 21:19:20 +02:00
Library_PresentationMinimizer.mk sdext/minimizer: create instances with uno constructors 2020-07-17 09:30:41 +02:00
Library_PresenterScreen.mk sdext/presenter: create instances with uno constructors 2020-07-16 20:35:53 +02:00
Makefile
Module_sdext.mk
Package_pdfimport_xpdfimport.mk
README.md Updated README.md files to represent current code / use Markdown format 2021-04-07 17:47:16 +02:00

Extensions for the Impress and Draw Applications

source/pdfimport/ - PDF import

Uses an external poppler process to parse and handle PDF import as draw shapes.

source/minimizer/ - Presentation Minimizer

Shrinks presentations by down-scaling images, and removing extraneous eg. embedded OLE content.

source/presenter/ - Impress / Presenter Console.

This couples to sd/ in rather strange ways. Its design is heavily mangled by an attempt to use only UNO interfaces which are highly inadequate. This leads to somewhat ridiculous situations. Activating in response to configuration keys (for example), and the XPresenterHelper interface inside sd/ used to create and manage windows.

The main screen uses a hardware-accelerated canvas (e.g. cairo canvas), while the entire secondary screen uses a VCL-canvas that is created in sd::framework::FullScreenPane::CreateCanvas().

The secondary screen contains 3 Panes which each have 2 XWindows for the border area & the actual content, and each content Pane is backed by a sd::presenter::PresenterCanvas that wraps the FullScreenPane's canvas and does clipping.