mgieseki / dvisvgm

A fast DVI, EPS, and PDF to SVG converter
https://dvisvgm.de
GNU General Public License v3.0
310 stars 34 forks source link

Crash when attempting to convert a simple PDF file using mutool #243

Closed oakad closed 1 year ago

oakad commented 1 year ago

dvisvgm version 3.0.4 mutool version 1.22.2

The crash is as following (looks like an std::vector capacity issue):

4 0x00007ffff62dd3b2 in std::__glibcxx_assert_fail (

file=file@entry=0x55555567dff8 "/usr/include/c++/13.1.1/bits/stl_vector.h", line=line@entry=1125, function=function@entry=0x5555556824c0 "std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator [with _Tp = char; _Alloc = std::allocator; reference = char&; size_type = long unsigned int]", condition=condition@entry=0x55555567d561 "__n < this->size()") at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/debug.cc:61

5 0x0000555555672ce0 in std::vector<char, std::allocator >::operator[]

(this=, __n=) at /usr/include/c++/13.1.1/bits/stl_vector.h:1125

6 std::vector<char, std::allocator >::operator[] (__n=,

this=, this=, __n=) at /usr/include/c++/13.1.1/bits/stl_vector.h:1123

7 Subprocess::read[abi:cxx11](SearchPattern const&, bool*) (

error=, pattern=..., this=) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/Process.cpp:74

8 Subprocess::readFromPipe (pattern=..., out="", this=)

at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/Process.cpp:290

9 Process::run(std::__cxx11::basic_string<char, std::char_traits, std::allocator >*, SearchPattern const&, Process::PipeFlags) [clone .isra.0] (

this=this@entry=0x7fffffffbda0, out=out@entry=0x7fffffffc120, pattern=..., flags=) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/Process.cpp:126

10 0x00005555555e9b01 in PDFHandler::mutool (cmd=..., pattern=...,

readFromStderr=) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/PDFHandler.cpp:813

11 0x0000555555660ea8 in PDFHandler::mtShow(std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&, SearchPattern const&, char) [clone .constprop.0] (fname=..., path=..., pattern=...,

fmtmode=98 'b') at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/PDFHandler.cpp:840

12 0x00005555555e4427 in PDFHandler::mtShow (fmtmode=98 'b', pattern=...,

path="pages/1/Contents/*", this=0x55555579c818) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/PDFHandler.hpp:70

13 PDFHandler::initPage (context=std::unique_ptr = {...},

pageno=, this=0x55555579c818) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/PDFHandler.cpp:222

14 PDFHandler::convert (this=0x55555579c818, fname=...,

pageno=, context=...) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/PDFHandler.cpp:155

15 0x00005555555f676f in PDFToSVG::convert (this=0x55555579c240, pageno=1)

at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/PDFToSVG.cpp:88

16 0x000055555559672e in ImageToSVG::convert (pageinfo=0x7fffffffc748,

lastPage=1, firstPage=, this=0x55555579c240) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/ImageToSVG.cpp:129

17 ImageToSVG::convert (pageinfo=0x7fffffffc748, rangestr="1",

this=0x55555579c240) at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/ImageToSVG.cpp:147

18 convert_file (fnameIndex=fnameIndex@entry=0, cmdline=...)

at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/dvisvgm.cpp:434

19 0x000055555558ba61 in main (argc=, argv=)

at /usr/src/debug/dvisvgm/dvisvgm-3.0.4/src/dvisvgm.cpp:493

mgieseki commented 1 year ago

Please provide a small PDF file to reproduce the issue. I guess it's the same as #242 which has already been fixed.

oakad commented 1 year ago

Attached. The failure indeed looks similar.

reg1.pdf

mgieseki commented 1 year ago

Thanks for uploading the file. I can confirm that 9148be867ea02b31eb0b1be0dee863524816a325 fixes the bug. So I'm closing the ticket here. Feel free to open a new one if you stumble over any further issues.