poppler issueshttps://gitlab.freedesktop.org/poppler/poppler/-/issues2021-04-13T17:11:35Zhttps://gitlab.freedesktop.org/poppler/poppler/-/issues/1066pdftocairo does not allow to generate SVG files intended for screen usage2021-04-13T17:11:35ZAnton Danilkinpdftocairo does not allow to generate SVG files intended for screen usageSome SVG files are intended to be displayed and not printed, but `pdftocairo` will always do `cairoOut->setPrinting(true);` for SVG files, and there is no way to change it.Some SVG files are intended to be displayed and not printed, but `pdftocairo` will always do `cairoOut->setPrinting(true);` for SVG files, and there is no way to change it.https://gitlab.freedesktop.org/poppler/poppler/-/issues/1067pdftocairo does not allow to change the SVG dimensions2021-04-13T17:11:58ZAnton Danilkinpdftocairo does not allow to change the SVG dimensionsIt looks like [the `getOutputSize` function](https://gitlab.freedesktop.org/poppler/poppler/-/blob/db1bf17777068a34e7586236efefb74a42460932/utils/pdftocairo.cc#L497-516) does not allow to change the output size if we are in the printing ...It looks like [the `getOutputSize` function](https://gitlab.freedesktop.org/poppler/poppler/-/blob/db1bf17777068a34e7586236efefb74a42460932/utils/pdftocairo.cc#L497-516) does not allow to change the output size if we are in the printing mode, and because we are always in the printing mode because of #1066, the end result is that (it seem that) there is no way to change the output size for SVG files.https://gitlab.freedesktop.org/poppler/poppler/-/issues/1065stack overflow in Error.cc:74 with pdftops2021-04-14T07:15:57ZDoudou Huangstack overflow in Error.cc:74 with pdftopsHi, there.
There is a stack overflow in Error.cc:74, which causes a segmentation fault and may lead to denial of service in version 29c3fc62d4997bb514d4748cca264fc6868cb52d. I have also verified this from 0.74.
To reproduce, run
~~~~
...Hi, there.
There is a stack overflow in Error.cc:74, which causes a segmentation fault and may lead to denial of service in version 29c3fc62d4997bb514d4748cca264fc6868cb52d. I have also verified this from 0.74.
To reproduce, run
~~~~
pdftops -level1sep POC
~~~~
Here is the call stack reported by ASAN:
~~~~
==79735==ERROR: AddressSanitizer: stack-overflow on address 0x7ffff71b7ff8 (pc 0x7f89183c1652 bp 0x7ffff71b8590 sp 0x7ffff71b8000 T0)
#0 0x7f89183c1651 in _IO_default_xsputn (/lib/x86_64-linux-gnu/libc.so.6+0x7b651)
#1 0x7f891839451a in vfprintf (/lib/x86_64-linux-gnu/libc.so.6+0x4e51a)
#2 0x7f8918395f00 (/lib/x86_64-linux-gnu/libc.so.6+0x4ff00)
#3 0x7f891839333c in vfprintf (/lib/x86_64-linux-gnu/libc.so.6+0x4d33c)
#4 0x7f891845cc88 in __fprintf_chk (/lib/x86_64-linux-gnu/libc.so.6+0x116c88)
#5 0x7f8918cde5f1 in fprintf /usr/include/x86_64-linux-gnu/bits/stdio2.h:98
#6 0x7f8918cde5f1 in error(ErrorCategory, long long, char const*, ...) poppler/Error.cc:74
#7 0x7f8918e04aaf in Parser::getObj(bool, unsigned char const*, CryptAlgorithm, int, int, int, int, bool, bool) poppler/Parser.cc:12
#8 0x7f8918e0489b in Parser::getObj(bool, unsigned char const*, CryptAlgorithm, int, int, int, int, bool, bool) poppler/Parser.cc:14
#9 0x7f8918e89ada in XRef::fetch(int, int, int, long long*) poppler/XRef.cc:1180
#10 0x7f8918e8b45d in XRef::fetch(Ref, int) poppler/XRef.cc:1131
#11 0x7f8918df0d00 in Object::fetch(XRef*, int) const poppler/Object.cc:78
#12 0x7f8918cd73e2 in Dict::lookup(char const*, int) const poppler/Dict.cc:167
#13 0x7f8918eb71d9 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1831
#14 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#15 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#16 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#17 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#18 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#19 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#20 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#21 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#22 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#23 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#24 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#25 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#26 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#27 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#28 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#29 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#30 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#31 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#32 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#33 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#34 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#35 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#36 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#37 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#38 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#39 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#40 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#41 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#42 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#43 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#44 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#45 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#46 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#47 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#48 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#49 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#50 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#51 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#52 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#53 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#54 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#55 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#56 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#57 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#58 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#59 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#60 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#61 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#62 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#63 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#64 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#65 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#66 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#67 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#68 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#69 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#70 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#71 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#72 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#73 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#74 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#75 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#76 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#77 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#78 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#79 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#80 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#81 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#82 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#83 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#84 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#85 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#86 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#87 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#88 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#89 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#90 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#91 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#92 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#93 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#94 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#95 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#96 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#97 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#98 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#99 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) oppler/PSOutputDev.cc:1833
#100 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#101 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#102 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#103 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#104 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#105 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#106 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#107 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#108 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#109 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#110 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#111 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#112 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#113 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#114 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#115 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#116 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#117 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#118 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#119 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#120 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#121 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#122 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#123 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#124 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#125 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#126 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#127 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#128 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#129 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#130 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#131 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#132 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#133 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#134 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#135 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#136 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#137 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#138 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#139 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#140 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#141 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#142 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#143 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#144 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#145 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#146 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#147 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#148 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#149 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#150 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#151 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#152 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#153 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#154 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#155 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#156 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#157 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#158 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#159 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#160 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#161 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#162 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#163 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#164 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#165 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#166 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#167 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#168 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#169 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#170 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#171 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#172 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#173 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#174 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#175 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#176 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#177 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#178 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#179 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#180 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#181 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#182 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#183 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#184 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#185 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#186 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#187 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#188 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#189 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#190 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#191 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#192 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#193 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#194 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#195 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#196 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#197 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#198 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#199 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#200 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#201 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#202 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#203 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#204 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#205 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#206 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#207 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#208 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#209 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#210 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#211 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#212 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#213 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#214 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#215 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#216 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#217 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#218 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#219 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#220 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#221 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#222 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#223 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#224 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#225 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#226 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#227 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#228 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#229 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#230 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#231 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#232 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#233 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#234 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#235 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#236 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#237 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#238 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#239 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#240 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#241 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#242 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#243 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#244 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#245 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#246 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#247 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#248 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#249 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#250 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#251 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
#252 0x7f8918eb7543 in PSOutputDev::setupResources(Dict*) poppler/PSOutputDev.cc:1833
SUMMARY: AddressSanitizer: stack-overflow ??:0 _IO_default_xsputn
==79735==ABORTING
~~~~
[seg-error74](/uploads/d577705d132f3804ae268c2b242b00a0/seg-error74)https://gitlab.freedesktop.org/poppler/poppler/-/issues/927incorrect size on pdftoppm2021-04-14T20:51:06ZStefano Padovanincorrect size on pdftoppmUsing the attached file with following command (on poppler 0.89.0), the png file produced is 257x256, instead of 256x256.
`pdftoppm -scale-dimension-before-rotation -r 200 pmc6187247.pdf -f 1 -l 13 -scale-to-x 256 -scale-to-y 256 -sing...Using the attached file with following command (on poppler 0.89.0), the png file produced is 257x256, instead of 256x256.
`pdftoppm -scale-dimension-before-rotation -r 200 pmc6187247.pdf -f 1 -l 13 -scale-to-x 256 -scale-to-y 256 -singlefile -png > scaled.png`
[pmc6187247.pdf](/uploads/5a955bf422bbb3cc9b9bb7393afcae4d/pmc6187247.pdf)https://gitlab.freedesktop.org/poppler/poppler/-/issues/1069GCC 11 errors: error: argument 2 of '__atomic_load' must not be a pointer to ...2021-04-15T12:34:41ZMartin LiškaGCC 11 errors: error: argument 2 of '__atomic_load' must not be a pointer to a 'volatile' typeUsing GCC 11 I see the following warnings:
```
[ 39s] cd /home/abuild/rpmbuild/BUILD/poppler-21.03.0/build/glib && /usr/bin/c++ -DG_LOG_DOMAIN=\"Poppler\" -Dpoppler_glib_EXPORTS -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0 -I/home/ab...Using GCC 11 I see the following warnings:
```
[ 39s] cd /home/abuild/rpmbuild/BUILD/poppler-21.03.0/build/glib && /usr/bin/c++ -DG_LOG_DOMAIN=\"Poppler\" -Dpoppler_glib_EXPORTS -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0 -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/fofi -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/goo -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/poppler -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/build -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/build/poppler -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib -I/home/abuild/rpmbuild/BUILD/poppler-21.03.0/build/glib -isystem /usr/include/freetype2 -isystem /usr/include/openjpeg-2.4 -isystem /usr/include/glib-2.0 -isystem /usr/lib64/glib-2.0/include -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/cairo -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wcast-align -Wformat-security -Wframe-larger-than=65536 -Wlogical-op -Wmissing-format-attribute -Wnon-virtual-dtor -Woverloaded-virtual -Wmissing-declarations -Wundef -Wzero-as-null-pointer-constant -Wshadow -Wsuggest-override -fno-exceptions -fno-check-new -fno-common -fno-operator-names -D_DEFAULT_SOURCE -O2 -g -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -DNDEBUG -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pthread -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -pthread -std=c++14 -o CMakeFiles/poppler-glib.dir/poppler-action.cc.o -c /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-action.cc
[ 39s] In file included from /usr/include/glib-2.0/glib/gthread.h:32,
[ 39s] from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
[ 39s] from /usr/include/glib-2.0/glib.h:32,
[ 39s] from /usr/include/glib-2.0/gobject/gbinding.h:28,
[ 39s] from /usr/include/glib-2.0/glib-object.h:22,
[ 39s] from /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler.h:22,
[ 39s] from /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-action.cc:19:
[ 39s] /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-action.cc: In function 'GType poppler_dest_get_type()':
[ 39s] /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-private.h:154:13: error: argument 2 of '__atomic_load' must not be a pointer to a 'volatile' type
[ 39s] 154 | if (g_once_init_enter(&g_define_type_id__volatile)) { \
[ 39s] | ^~~~~~~~~~~~~~~~~
[ 39s] /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-action.cc:28:1: note: in expansion of macro 'POPPLER_DEFINE_BOXED_TYPE'
[ 39s] 28 | POPPLER_DEFINE_BOXED_TYPE(PopplerDest, poppler_dest, poppler_dest_copy, poppler_dest_free)
[ 39s] | ^~~~~~~~~~~~~~~~~~~~~~~~~
[ 39s] /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-action.cc: In function 'GType poppler_action_get_type()':
[ 39s] /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-private.h:154:13: error: argument 2 of '__atomic_load' must not be a pointer to a 'volatile' type
[ 39s] 154 | if (g_once_init_enter(&g_define_type_id__volatile)) { \
[ 39s] | ^~~~~~~~~~~~~~~~~
[ 39s] /home/abuild/rpmbuild/BUILD/poppler-21.03.0/glib/poppler-action.cc:91:1: note: in expansion of macro 'POPPLER_DEFINE_BOXED_TYPE'
[ 39s] 91 | POPPLER_DEFINE_BOXED_TYPE(PopplerAction, poppler_action, poppler_action_copy, poppler_action_free)
[ 39s] | ^~~~~~~~~~~~~~~~~~~~~~~~~
[ 39s] make[2]: *** [glib/CMakeFiles/poppler-glib.dir/build.make:120: glib/CMakeFiles/poppler-glib.dir/poppler-action.cc.o] Error 1
```https://gitlab.freedesktop.org/poppler/poppler/-/issues/912Can't catch the error of page creation2021-04-15T14:41:03ZИгорь БуяновCan't catch the error of page creationHello.
I faced with catching an error problem. I try to create a page, but the program prints me
> poppler/error: Failed to parse XRef entry [733].poppler/error: Top-level pages object is wrong type (null)
My code for catching such a...Hello.
I faced with catching an error problem. I try to create a page, but the program prints me
> poppler/error: Failed to parse XRef entry [733].poppler/error: Top-level pages object is wrong type (null)
My code for catching such a problems looks like this
```cpp
poppler::page* p;
if((p = pDoc_pdf->create_page(i)) == NULL)
{
corrupted_pages[filepath].push_back(i);
continue;
}
pdf_text = p->text();
```
According to the documentation [here](https://poppler.freedesktop.org/api/cpp/classpoppler_1_1document.html#a39257206a337df2f56049f385d433821) the function **create_page** should return exactly **NULL** if something goes wrong. Unfortunately, it doesn't work and when I try to get the text, the program crashes.
Digging into the code of poppler, I realized, that it actually would return the **nullptr**, so I tried to replace the **NULL** to **nullptr**. However, it doesn't work and the condition is passed anyway.
I attached the [file](/uploads/a6dd7f70027f214444f6a6f0bdeb3fdd/Моделист-Конструктор_1985-01.pdf), that causes an error.
Thank for the help.https://gitlab.freedesktop.org/poppler/poppler/-/issues/987Crash in GlobalParams::getResidentUnicodeMap2021-04-15T14:41:51ZBjörn Daasebjoern.daase@gmail.comCrash in GlobalParams::getResidentUnicodeMap## Affected version
* Fedora 33
* poppler 0.90.0
## Steps to reproduce
Unclear.
## Bug Summary
Poppler randomly crashed for me while I was using evince.
Here is the trace
```GNU gdb (GDB) Fedora 10.1-2.fc33
GNU gdb (GDB) Fedora 10.1-...## Affected version
* Fedora 33
* poppler 0.90.0
## Steps to reproduce
Unclear.
## Bug Summary
Poppler randomly crashed for me while I was using evince.
Here is the trace
```GNU gdb (GDB) Fedora 10.1-2.fc33
GNU gdb (GDB) Fedora 10.1-2.fc33
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/evince...
Reading symbols from /usr/lib/debug/usr/bin/evince-3.38.0-1.fc33.x86_64.debug...
warning: Can't open file /home/bjoern/.local/share/gvfs-metadata/home-3816c159.log during file-backed mapping note processing
warning: Can't open file /memfd:wayland-cursor (deleted) during file-backed mapping note processing
[New LWP 7737]
[New LWP 7735]
[New LWP 7731]
[New LWP 7736]
[New LWP 7733]
[New LWP 11926]
Missing separate debuginfo for /lib64/libevview3.so.3
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/7c/3979633be4550916b2c81f72f6285dee9d12a3.debug
Missing separate debuginfo for /lib64/libevdocument3.so.4
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/79/02a3b7fa950c56b4c7788ecb7e15209dcdd196.debug
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /lib64/libwayland-cursor.so.0
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/f4/cbabae667f215f081d7d9dc1abce287ada7286.debug
Missing separate debuginfo for /lib64/libwayland-egl.so.1
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/cb/d1930f8c301540f565bbb2761aa45547ede38b.debug
Missing separate debuginfo for /usr/lib64/evince/4/backends/libpdfdocument.so
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/40/e1427a54f8b8a7822b516b5312db184aa92751.debug
Core was generated by `evince /home/bjoern/HPI/Master/Data Management on Modern Storage Technologies/p'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f5c0e52c878 in std::_Hash_bytes(void const*, unsigned long, unsigned long) () from /lib64/libstdc++.so.6
[Current thread is 1 (Thread 0x7f5c0f296640 (LWP 7737))]
Missing separate debuginfos, use: dnf debuginfo-install at-spi2-atk-2.38.0-1.fc33.x86_64 at-spi2-core-2.38.0-2.fc33.x86_64 atk-2.36.0-2.fc33.x86_64 bzip2-libs-1.0.8-4.fc33.x86_64 cairo-1.16.0-9.fc33.x86_64 cairo-gobject-1.16.0-9.fc33.x86_64 cyrus-sasl-lib-2.1.27-6.fc33.x86_64 dbus-libs-1.12.20-2.fc33.x86_64 dconf-0.38.0-1.fc33.x86_64 elfutils-debuginfod-client-0.182-1.fc33.x86_64 elfutils-libelf-0.182-1.fc33.x86_64 elfutils-libs-0.182-1.fc33.x86_64 fontconfig-2.13.92-12.fc33.x86_64 freetype-2.10.4-1.fc33.x86_64 fribidi-1.0.10-3.fc33.x86_64 gdk-pixbuf2-2.40.0-3.fc33.x86_64 gnome-desktop3-3.38.1-1.fc33.x86_64 graphite2-1.3.14-6.fc33.x86_64 gspell-1.8.4-1.fc33.x86_64 gstreamer1-1.18.1-1.fc33.x86_64 gstreamer1-plugins-base-1.18.1-1.fc33.x86_64 gtk3-3.24.23-1.fc33.x86_64 gvfs-client-1.46.1-1.fc33.x86_64 jbigkit-libs-2.1-19.fc33.x86_64 keyutils-libs-1.6-5.fc33.x86_64 krb5-libs-1.18.2-29.fc33.x86_64 lcms2-2.11-2.fc33.x86_64 libX11-1.6.12-3.fc33.x86_64 libXau-1.0.9-4.fc33.x86_64 libXcomposite-0.4.5-3.fc33.x86_64 libXcursor-1.2.0-3.fc33.x86_64 libXdamage-1.1.5-3.fc33.x86_64 libXext-1.3.4-4.fc33.x86_64 libXfixes-5.0.3-12.fc33.x86_64 libXi-1.7.10-4.fc33.x86_64 libXinerama-1.1.4-6.fc33.x86_64 libXrandr-1.5.2-4.fc33.x86_64 libbrotli-1.0.9-3.fc33.x86_64 libcom_err-1.45.6-4.fc33.x86_64 libcurl-7.71.1-7.fc33.x86_64 libdatrie-0.2.9-12.fc33.x86_64 libepoxy-1.5.4-3.fc33.x86_64 libgcc-10.2.1-6.fc33.x86_64 libidn2-2.3.0-4.fc33.x86_64 libjpeg-turbo-2.0.5-5.fc33.x86_64 libmount-2.36-3.fc33.x86_64 libseccomp-2.5.0-3.fc33.x86_64 libsecret-0.20.3-2.fc33.x86_64 libselinux-3.1-2.fc33.x86_64 libssh-0.9.5-1.fc33.x86_64 libstdc++-10.2.1-6.fc33.x86_64 libthai-0.1.28-5.fc33.x86_64 libtiff-4.1.0-4.fc33.x86_64 libunistring-0.9.10-9.fc33.x86_64 libunwind-1.4.0-4.fc33.x86_64 libxcb-1.13.1-5.fc33.x86_64 libxcrypt-4.4.17-1.fc33.x86_64 libxkbcommon-1.0.1-1.fc33.x86_64 libxml2-2.9.10-7.fc33.x86_64 libzstd-1.4.5-5.fc33.x86_64 lz4-libs-1.9.1-3.fc33.x86_64 nss-util-3.58.0-3.fc33.x86_64 openjpeg2-2.3.1-7.fc33.x86_64 openldap-2.4.50-5.fc33.x86_64 openssl-libs-1.1.1h-1.fc33.x86_64 orc-0.4.31-3.fc33.x86_64 pango-1.47.0-1.fc33.x86_64 pcre-8.44-2.fc33.x86_64 pixman-0.40.0-2.fc33.x86_64 texlive-lib-20200327-16.fc33.x86_64 xz-libs-5.2.5-3.fc33.x86_64
(gdb) thread apply all bt full
Thread 6 (Thread 0x7f5c15077640 (LWP 11926)):
#0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1 0x00007f5c25999a38 in g_cond_wait_until (end_time=<optimized out>, mutex=0x5612da092030, cond=0x5612da092038) at ../glib/gthread-posix.c:1592
span = {tv_sec = 0, tv_nsec = 499999184}
success = <optimized out>
now = {tv_sec = 4816, tv_nsec = 490385816}
sampled = 93
res = <optimized out>
#2 g_cond_wait_until (cond=0x5612da092038, mutex=0x5612da092030, end_time=<optimized out>) at ../glib/gthread-posix.c:1565
#3 0x00007f5c2591f341 in g_async_queue_pop_intern_unlocked (queue=0x5612da092030, wait=1, end_time=4816990385) at ../glib/gasyncqueue.c:422
retval = <optimized out>
__func__ = "g_async_queue_pop_intern_unlocked"
#4 0x00007f5c2597db6a in g_thread_pool_wait_for_new_task (pool=<optimized out>) at ../glib/gthreadpool.c:278
task = <optimized out>
task = <optimized out>
pool = <optimized out>
#5 g_thread_pool_thread_proxy (data=<optimized out>) at ../glib/gthreadpool.c:343
task = <optimized out>
pool = <optimized out>
#6 0x00007f5c2597aede in g_thread_proxy (data=0x5612da356b00) at ../glib/gthread.c:820
thread = 0x5612da356b00
__func__ = "g_thread_proxy"
#7 0x00007f5c247033f9 in start_thread (arg=0x7f5c15077640) at pthread_create.c:463
ret = <optimized out>
pd = 0x7f5c15077640
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140033466529344, 1505429635690707739, 140723487135918, 140723487135919, 0, 140033466529344, -1559241311390745829, -1559348661683438821}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = 0
#8 0x00007f5c24b8bb03 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 5 (Thread 0x7f5c15878640 (LWP 7733)):
#0 0x00007f5c24b80a0f in __GI___poll (fds=0x5612da092650, nfds=2, timeout=100) at ../sysdeps/unix/sysv/linux/poll.c:29
sc_ret = -516
sc_cancel_oldtype = 0
#1 0x00007f5c2599ed1e in g_main_context_poll (priority=<optimized out>, n_fds=2, fds=0x5612da092650, timeout=<optimized out>, context=0x5612da093af0) at ../glib/gmain.c:4395
ret = <optimized out>
errsv = <optimized out>
poll_func = 0x7f5c25953600 <g_poll>
max_priority = 2147483647
timeout = 100
some_ready = <optimized out>
nfds = 2
allocated_nfds = <optimized out>
fds = 0x5612da092650
#2 g_main_context_iterate.constprop.0 (context=context@entry=0x5612da093af0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4087
max_priority = 2147483647
timeout = 100
some_ready = <optimized out>
nfds = 2
allocated_nfds = <optimized out>
fds = 0x5612da092650
--Type <RET> for more, q to quit, c to continue without paging--c
#3 0x00007f5c2594b41f in g_main_context_iteration (context=0x5612da093af0, may_block=may_block@entry=1) at ../glib/gmain.c:4157
retval = <optimized out>
#4 0x00007f5c2594d031 in glib_worker_main (data=<optimized out>) at ../glib/gmain.c:6049
#5 0x00007f5c2597aede in g_thread_proxy (data=0x5612da047980) at ../glib/gthread.c:820
thread = 0x5612da047980
__func__ = "g_thread_proxy"
#6 0x00007f5c247033f9 in start_thread (arg=0x7f5c15878640) at pthread_create.c:463
ret = <optimized out>
pd = 0x7f5c15878640
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140033474922048, 1505429635690707739, 140723487136782, 140723487136783, 0, 140033474922048, -1559240211342247141, -1559348661683438821}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = 0
#7 0x00007f5c24b8bb03 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 4 (Thread 0x7f5c1482a640 (LWP 7736)):
#0 0x00007f5c24b80a0f in __GI___poll (fds=0x5612da0a8f00, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
sc_ret = -516
sc_cancel_oldtype = 0
#1 0x00007f5c2599ed1e in g_main_context_poll (priority=<optimized out>, n_fds=1, fds=0x5612da0a8f00, timeout=<optimized out>, context=0x5612da0a90f0) at ../glib/gmain.c:4395
ret = <optimized out>
errsv = <optimized out>
poll_func = 0x7f5c25953600 <g_poll>
max_priority = 2147483647
timeout = -1
some_ready = <optimized out>
nfds = 1
allocated_nfds = <optimized out>
fds = 0x5612da0a8f00
#2 g_main_context_iterate.constprop.0 (context=context@entry=0x5612da0a90f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4087
max_priority = 2147483647
timeout = -1
some_ready = <optimized out>
nfds = 1
allocated_nfds = <optimized out>
fds = 0x5612da0a8f00
#3 0x00007f5c2594b41f in g_main_context_iteration (context=0x5612da0a90f0, may_block=1) at ../glib/gmain.c:4157
retval = <optimized out>
#4 0x00007f5c25b5a64d in dconf_gdbus_worker_thread () at /usr/lib64/gio/modules/libdconfsettings.so
#5 0x00007f5c2597aede in g_thread_proxy (data=0x5612da0ac8c0) at ../glib/gthread.c:820
thread = 0x5612da0ac8c0
__func__ = "g_thread_proxy"
#6 0x00007f5c247033f9 in start_thread (arg=0x7f5c1482a640) at pthread_create.c:463
ret = <optimized out>
pd = 0x7f5c1482a640
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140033457825344, 1505429635690707739, 140723487136382, 140723487136383, 0, 140033457825344, -1559242443651499237, -1559348661683438821}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = 0
#7 0x00007f5c24b8bb03 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 3 (Thread 0x7f5c236310c0 (LWP 7731)):
#0 0x00007f5c239bbadc in _fini () at /lib64/liblz4.so.1
#1 0x00007f5c25b77d05 in _dl_fini () at dl-fini.c:144
l = 0x7f5c23a774f0
maps = 0x7ffcbd765ed0
i = 49
l = <optimized out>
nmaps = <optimized out>
nloaded = <optimized out>
ns = 0
do_audit = <optimized out>
__PRETTY_FUNCTION__ = "_dl_fini"
#2 0x00007f5c24aca427 in __run_exit_handlers (status=0, listp=0x7f5c24c4f598 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
atfct = <optimized out>
onfct = <optimized out>
cxafct = <optimized out>
f = <optimized out>
new_exitfn_called = 22
cur = 0x7f5c24c51980 <initial>
#3 0x00007f5c24aca5d0 in __GI_exit (status=<optimized out>) at exit.c:139
#4 0x00007f5c24ab21a9 in __libc_start_main (main=0x5612d91b5f10 <main>, argc=2, argv=0x7ffcbd766478, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffcbd766468) at ../csu/libc-start.c:348
result = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {0, -5133559885728793829, 94638951851792, 0, 0, 0, -1505004181192131813, -1559348206890992869}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x2, 0x7ffcbd766478}, data = {prev = 0x0, cleanup = 0x0, canceltype = 2}}}
not_first_call = <optimized out>
#5 0x00005612d91b673e in _start ()
Thread 2 (Thread 0x7f5c0ffff640 (LWP 7735)):
#0 0x00007f5c24b80a0f in __GI___poll (fds=0x7f5c0800fa80, nfds=3, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
sc_ret = -516
sc_cancel_oldtype = 0
#1 0x00007f5c2599ed1e in g_main_context_poll (priority=<optimized out>, n_fds=3, fds=0x7f5c0800fa80, timeout=<optimized out>, context=0x7f5c0800db50) at ../glib/gmain.c:4395
ret = <optimized out>
errsv = <optimized out>
poll_func = 0x7f5c25953600 <g_poll>
max_priority = 2147483647
timeout = -1
some_ready = <optimized out>
nfds = 3
allocated_nfds = <optimized out>
fds = 0x7f5c0800fa80
#2 g_main_context_iterate.constprop.0 (context=0x7f5c0800db50, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4087
max_priority = 2147483647
timeout = -1
some_ready = <optimized out>
nfds = 3
allocated_nfds = <optimized out>
fds = 0x7f5c0800fa80
#3 0x00007f5c2594d6ab in g_main_loop_run (loop=0x7f5c0800dc40) at ../glib/gmain.c:4290
__func__ = "g_main_loop_run"
#4 0x00007f5c24dc56b6 in gdbus_shared_thread_func (user_data=0x7f5c0800db20) at ../gio/gdbusprivate.c:280
data = 0x7f5c0800db20
#5 0x00007f5c2597aede in g_thread_proxy (data=0x7f5c08001920) at ../glib/gthread.c:820
thread = 0x7f5c08001920
__func__ = "g_thread_proxy"
#6 0x00007f5c247033f9 in start_thread (arg=0x7f5c0ffff640) at pthread_create.c:463
ret = <optimized out>
pd = 0x7f5c0ffff640
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140033382151744, 1505429635690707739, 140033466525662, 140033466525663, 0, 140033382151744, -1559296909742392549, -1559348661683438821}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = 0
#7 0x00007f5c24b8bb03 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Thread 1 (Thread 0x7f5c0f296640 (LWP 7737)):
#0 0x00007f5c0e52c878 in std::_Hash_bytes(void const*, unsigned long, unsigned long) () at /lib64/libstdc++.so.6
#1 0x00007f5c0e81fc25 in std::_Hash_impl::hash(void const*, unsigned long, unsigned long) (__seed=3339675911, __clength=<optimized out>, __ptr=<optimized out>) at /usr/include/c++/10/bits/functional_hash.h:197
__code = <optimized out>
__bkt = <optimized out>
__p = <optimized out>
map = 0x0
#2 std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (__s="", this=0x7f5c00022850, this=<optimized out>, __s=<optimized out>) at /usr/include/c++/10/bits/basic_string.h:6803
__code = <optimized out>
__bkt = <optimized out>
__p = <optimized out>
map = 0x0
#3 std::__detail::_Hash_code_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, UnicodeMap>, std::__detail::_Select1st, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::_M_hash_code(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const (__k="", this=0x7f5c00022850) at /usr/include/c++/10/bits/hashtable_policy.h:1379
__code = <optimized out>
__bkt = <optimized out>
__p = <optimized out>
map = 0x0
#4 std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, UnicodeMap>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, UnicodeMap> >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (__k="", this=0x7f5c00022850) at /usr/include/c++/10/bits/hashtable.h:1452
__code = <optimized out>
__bkt = <optimized out>
__p = <optimized out>
map = 0x0
#5 std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, UnicodeMap, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, UnicodeMap> > >::find(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (__x="", this=0x7f5c00022850) at /usr/include/c++/10/bits/unordered_map.h:920
map = 0x0
#6 GlobalParams::getResidentUnicodeMap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (this=this@entry=0x7f5c00022800, encodingName="") at /usr/src/debug/poppler-0.90.0-6.fc33.x86_64/poppler/GlobalParams.cc:588
map = 0x0
#7 0x00007f5c0e821599 in GlobalParams::getUnicodeMap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (this=0x7f5c00022800, encodingName="") at /usr/src/debug/poppler-0.90.0-6.fc33.x86_64/poppler/GlobalParams.cc:1174
map = <optimized out>
#8 0x00007f5c0e89ec1a in TextPage::coalesce(bool, double, bool) (this=0x7f5c003c2600, physLayout=<optimized out>, fixedPitch=0, doHTML=<optimized out>) at /usr/src/debug/poppler-0.90.0-6.fc33.x86_64/poppler/TextOutputDev.cc:2850
pool = <optimized out>
word0 = <optimized out>
word1 = <optimized out>
word2 = <optimized out>
line = <optimized out>
blkList = <optimized out>
blk = <optimized out>
lastBlk = <optimized out>
blk0 = <optimized out>
blk1 = <optimized out>
blk2 = <optimized out>
flow = <optimized out>
lastFlow = <optimized out>
rot = <optimized out>
poolMinBaseIdx = <optimized out>
baseIdx = <optimized out>
startBaseIdx = <optimized out>
minBase = <optimized out>
maxBase = <optimized out>
newMinBase = <optimized out>
newMaxBase = <optimized out>
fontSize = <optimized out>
colSpace1 = <optimized out>
colSpace2 = <optimized out>
lineSpace = <optimized out>
intraLineSpace = <optimized out>
blkSpace = <optimized out>
found = <optimized out>
count = {-628857504, 22034, -628765504, 22034}
lrCount = <optimized out>
col1 = <optimized out>
col2 = <optimized out>
j = <optimized out>
n = <optimized out>
uMap = <optimized out>
sortPos = <optimized out>
bxMin0 = <optimized out>
byMin0 = <optimized out>
bxMin1 = <optimized out>
byMin1 = <optimized out>
numTables = <optimized out>
tableId = <optimized out>
correspondenceX = <optimized out>
correspondenceY = <optimized out>
xCentre1 = <optimized out>
yCentre1 = <optimized out>
xCentre2 = <optimized out>
yCentre2 = <optimized out>
xCentre3 = <optimized out>
yCentre3 = <optimized out>
xCentre4 = <optimized out>
yCentre4 = <optimized out>
deltaX = <optimized out>
deltaY = <optimized out>
fblk2 = <optimized out>
fblk3 = <optimized out>
fblk4 = <optimized out>
envelopes = <optimized out>
i = <optimized out>
#9 0x00007f5c0e8a8f46 in TextOutputDev::endPage() (this=0x7f5c0136ee30) at /usr/src/debug/poppler-0.90.0-6.fc33.x86_64/poppler/TextOutputDev.cc:5842
#10 0x00007f5c0ea1aeb6 in poppler_page_get_text_page(PopplerPage*) (page=0x5612da85ccc0 [PopplerPage]) at /usr/src/debug/poppler-0.90.0-6.fc33.x86_64/glib/poppler-page.cc:279
text_dev = 0x7f5c0136ee30
gfx = 0x7f5c02328460
#11 0x00007f5c0ea1d6c5 in poppler_page_get_selection_region(PopplerPage*, gdouble, PopplerSelectionStyle, PopplerRectangle*) (page=<optimized out>, scale=1, style=<optimized out>, selection=<optimized out>) at /usr/src/debug/poppler-0.90.0-6.fc33.x86_64/glib/poppler-page.cc:695
poppler_selection = {x1 = 0, y1 = 0, x2 = 439.37, y2 = 666.14199999999994}
text = <optimized out>
selection_style = selectionStyleGlyph
region = 0x0
list = <optimized out>
#12 0x00007f5c0ea8b2a6 in pdf_document_text_get_text_mapping(_EvDocumentText*, _EvPage*) () at /usr/lib64/evince/4/backends/libpdfdocument.so
#13 0x00007f5c25b024f6 in ev_job_page_data_run () at /lib64/libevview3.so.3
#14 0x00007f5c25b01cf9 in ev_job_thread_proxy () at /lib64/libevview3.so.3
#15 0x00007f5c2597aede in g_thread_proxy (data=0x5612da5ac0c0) at ../glib/gthread.c:820
thread = 0x5612da5ac0c0
__func__ = "g_thread_proxy"
#16 0x00007f5c247033f9 in start_thread (arg=0x7f5c0f296640) at pthread_create.c:463
ret = <optimized out>
pd = 0x7f5c0f296640
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140033368090176, 1505429635690707739, 140723487136830, 140723487136831, 0, 140033368090176, -1559298709870560485, -1559348661683438821}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = 0
#17 0x00007f5c24b8bb03 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
```https://gitlab.freedesktop.org/poppler/poppler/-/issues/1062pdftoppm: incorrect page size regression when using -scale-to2021-04-15T14:46:54ZAndy Claytonpdftoppm: incorrect page size regression when using -scale-toWith !807 I am seeing different behavior when using `-scale-to`. Following that fix there is white padding in the output that was not present previously and is not present in the source PDF.
I imagine the fix might be for the `scaleTo !...With !807 I am seeing different behavior when using `-scale-to`. Following that fix there is white padding in the output that was not present previously and is not present in the source PDF.
I imagine the fix might be for the `scaleTo != 0` case to assign only the larger of `pg_w` or `pg_h` to `scaleTo` while calculating the other based on resolution as before.
Command:
utils/pdftoppm -singlefile -scale-to 500 -png ./test.pdf
Input: [test.pdf](/uploads/b4fe3bfb00c6dce94a9f70f7a38c9b88/test.pdf)
Output:
| Output on master (as of 104fc940ca3c3eb8b706abd11d35be83dbcd0c3b) |
| ------ |
| ![head](/uploads/caacc1aca19bdacdf3543ec254c09a4c/head.png) |
| Output after reverting e21c83650f15a197b286f8eed8c7d723c6900925 |
| ------ |
| ![e21c8365-reverted](/uploads/3bf2bea3bf66276bce6c4d4483759e9b/e21c8365-reverted.png) |
Thanks for looking!
cc @sander @aacidhttps://gitlab.freedesktop.org/poppler/poppler/-/issues/1071Invalid Backgrounds causing SIGABRTs in `GfxShading::init`2021-04-21T22:04:15ZB HornInvalid Backgrounds causing SIGABRTs in `GfxShading::init`## Issue
Poppler SIGABRTs with the message `Internal Error (0): Call to Object where the object was type 10, not the expected type 1, 14 or 2` (and also with objects of type 11 as well, depending on input file) for certain files.
I've...## Issue
Poppler SIGABRTs with the message `Internal Error (0): Call to Object where the object was type 10, not the expected type 1, 14 or 2` (and also with objects of type 11 as well, depending on input file) for certain files.
I've tested the following versions, and the crash occurs on all of them:
* 21.04.0, built from source. What I'm fuzzing against.
* 20.09.0, from the ubuntu 20.10 package repositories.
* 0.62.0
### Backtrace
```
[#0] 0x7ffff78a88cb → __GI_raise(sig=0x6)
[#1] 0x7ffff788d864 → __GI_abort()
[#2] 0x7ffff7dca019 → GfxShading::init(GfxResources*, Dict*, OutputDev*, GfxState*)()
[#3] 0x7ffff7dcaf6f → GfxAxialShading::parse(GfxResources*, Dict*, OutputDev*, GfxState*)()
[#4] 0x7ffff7dcfc39 → GfxShading::parse(GfxResources*, Object*, OutputDev*, GfxState*)()
[#5] 0x7ffff7dcfd35 → GfxShadingPattern::parse(GfxResources*, Object*, OutputDev*, GfxState*, int)()
[#6] 0x7ffff7dd00ee → GfxPattern::parse(GfxResources*, Object*, OutputDev*, GfxState*, int)()
[#7] 0x7ffff7d92450 → GfxResources::lookupPattern(char const*, OutputDev*, GfxState*)()
[#8] 0x7ffff7d936c6 → Gfx::opSetFillColorN(Object*, int)()
[#9] 0x7ffff7d9d9a7 → Gfx::go(bool)()
```
## Testcases
* [out.pdf](/uploads/6189f89188df2524a2ac63b40746b88b/out.pdf) - afl-tmin minimized file. Not strictly a valid PDF, but does trigger the bug with pdftotext, evince, etc.
* [smallest.pdf](/uploads/0bd1d3d2f0b714a07cdf77f66d7d83d3/smallest.pdf) - smallest instance of this bug to come from my fuzzer.
## Triaging
(Line numbers are from 21.04.0's source release)
The SIGABRT is triggered by the macro `OBJECT_3TYPES_CHECK` in `Object.h`, which is only used by `Object::getNum()`.
In `GfxShading::init`, we see it gets called on line 3529:
```cpp
obj1 = dict->lookup("Background");
if (obj1.isArray()) {
if (obj1.arrayGetLength() == colorSpace->getNComps()) {
hasBackground = true;
for (i = 0; i < colorSpace->getNComps(); ++i) {
Object obj2 = obj1.arrayGet(i);
> background.c[i] = dblToCol(obj2.getNum());
}
} else {
error(errSyntaxWarning, -1, "Bad Background in shading dictionary");
}
}
```
So it seems the code is missing a check to see if `obj2` is number before we get to this point, causing the crash.
## Patch
I'm not an expert on the codebase, so please do double check this.
Seems that every other instance where `getNum()` is used in `GfxState.cc`, it is preceded by a call to `isNum()`. So a potential patch I wrote is:
```diff
diff --git a/GfxState.cc-old b/GfxState.cc
index 05ce3a8..b43818e 100644
--- a/GfxState.cc-old
+++ b/GfxState.cc
@@ -3526,7 +3526,12 @@ bool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *s
hasBackground = true;
for (i = 0; i < colorSpace->getNComps(); ++i) {
Object obj2 = obj1.arrayGet(i);
- background.c[i] = dblToCol(obj2.getNum());
+ if (obj2.isNum()) {
+ background.c[i] = dblToCol(obj2.getNum());
+ } else {
+ error(errSyntaxWarning, -1, "Bad Background in shading dictionary");
+ break;
+ }
}
} else {
error(errSyntaxWarning, -1, "Bad Background in shading dictionary");
```
Does resolve the issue as there are no longer any crashes when I apply the patch. However, not the cleanest fix, errors/warnings probably aren't up to the standard, etc.https://gitlab.freedesktop.org/poppler/poppler/-/issues/1072How to sign using pdfsig and improvements to man2021-05-02T19:56:38ZjdanitxuHow to sign using pdfsig and improvements to manI'm in **poppler-utils version 21.02.0-1** checking the new sign functionality.
Looking at `man pdfsig` it says I must use "-sign number" to sign a PDF. My related issues:
1. The man documentation is not clear when it says "Sign the do...I'm in **poppler-utils version 21.02.0-1** checking the new sign functionality.
Looking at `man pdfsig` it says I must use "-sign number" to sign a PDF. My related issues:
1. The man documentation is not clear when it says "Sign the document in the signature field with the given number". Looking at pdfsig.cc in line 191 it seems it must be a yet contained signature inside the PDF. Then: should it be a signed PDF? what is the meaning of re-sign?
2. I suggest to write an example of how to use `-sign` option (by the way, for now I'm not able to use this functionality ;) )
3. I suggest to insert a newline in man documentation so `-sign number` appears in the next line instead of -dump... -sign
4. As signature functionality is a very important one, I suggest to change DESCRIPTION giving more weight to that instead of ending with "Moreover, with option -sign it can sign a PDF document". A proposal for DESCRIPTION:
**pdfsig** signs PDF documents and verifies digital signatures inside a PDF document ...
Thanks a lot in advance!https://gitlab.freedesktop.org/poppler/poppler/-/issues/129Annotations appear at the wrong place2021-05-02T21:17:18ZBugzilla Migration UserAnnotations appear at the wrong place## Submitted by ral..@..il.com
Assigned to **poppler-bugs**
**[Link to original bug (#96764)](https://bugs.freedesktop.org/show_bug.cgi?id=96764)**
## Description
Created attachment 124843
screenshot
When doing annotations (using...## Submitted by ral..@..il.com
Assigned to **poppler-bugs**
**[Link to original bug (#96764)](https://bugs.freedesktop.org/show_bug.cgi?id=96764)**
## Description
Created attachment 124843
screenshot
When doing annotations (using evince) on an old pdf the annotation (yellow highlight) shows up at the wrong position. See the attached screenshot, where I have tried to annotate the headline of the text ("Time series properties of an artificial
stock market") - but this happens for every part of text in the pdf (which I have tried). However I get the annotation window when i click on the text which I annotated and not when I click on the yellow area.
Since the pdf on which I have noticed this bug is copyrighted I will not upload it here (you can download it here: http://www.sciencedirect.com/science/article/pii/S0165188998000815 or send me an Email if you do not have access to it).
The pdf is PDF-1.2 and was created using "Acrobat Distiller 3.02 for Power Macintosh" in the year 1999.
This is not the first old pdf in which I have noticed this behaviour, however newer pdf's usually work as expected. This does not happen in foxitreader and apparently also not in ezPDF(https://bugzilla.gnome.org/show_bug.cgi?id=768246).
**Attachment 124843**, "screenshot":
![bug](/uploads/348c7fa2b75e6e8f35a38907c483b581/bug.png)
### See also
* [Bug 768246](https://bugzilla.gnome.org/show_bug.cgi?id=768246)https://gitlab.freedesktop.org/poppler/poppler/-/issues/1075Outline/table of contents modification2021-05-04T14:20:14ZR MOutline/table of contents modificationAs suggested, a diff of some code I wrote to insert an Outline into a PDF w/ or without an existing Outline. Only wholesale replacement of table of contents is supported although it seems like more granular access would be beneficial to...As suggested, a diff of some code I wrote to insert an Outline into a PDF w/ or without an existing Outline. Only wholesale replacement of table of contents is supported although it seems like more granular access would be beneficial to graphical programs.
Changes to Outline.h/cc, and Catalog.h/cc
A small program to demonstrate the functionality. [pdftoc.cc](/uploads/795d448bb720f43b582e144b51b3470e/pdftoc.cc)
[poppler_outline.patch](/uploads/4c53ef71f10a84bb1829905ec5d4068e/poppler_outline.patch)https://gitlab.freedesktop.org/poppler/poppler/-/issues/1052Cyrillic letters display as rectangles2021-05-11T16:01:13ZDmitry ShubinCyrillic letters display as rectanglesI have two pretty similar files which use the same base font: [Chertezh_v15.pdf](/uploads/c6f10707a3eecb4c52f9f2a9816a256e/Chertezh_v15.pdf) displays well, while [Chertezh_V16.pdf](/uploads/f3b6eb4e143599c75e1ecd43cad4e590/Chertezh_V16.p...I have two pretty similar files which use the same base font: [Chertezh_v15.pdf](/uploads/c6f10707a3eecb4c52f9f2a9816a256e/Chertezh_v15.pdf) displays well, while [Chertezh_V16.pdf](/uploads/f3b6eb4e143599c75e1ecd43cad4e590/Chertezh_V16.pdf) renders Cyrillic characters as rectangle placeholders (tofu) in poppler 2021.3 (tried SVG and PNG output). Both files display well in Adobe Reader and Chrome.
Screenshot: [poppler-png-results](/uploads/9532653ce9d010ea5d199ec030745720/poppler-png-results.png)
Both files were created by "Compass 3D" software, v15 and v16 correspondingly.
Any idea on what is wrong or unsupported by poppler in the v16 file?
**Steps to reproduce:**
- Pull archlinux docker image
- Install poppler using `pacman -Sy poppler` command. Pdftocairo reports its version as `21.03.0`.
- run `pdftocairo -png -l 1 -f 1 Chertezh_v15.pdf Chertezh_V15.pdf.p2103.png` - result is OK, Cyrillic characters are displayed correctly
- run `pdftocairo -png -l 1 -f 1 Chertezh_V16.pdf Chertezh_V16.pdf.p2103.png` - result is NOT OK, Cyrillic characters are displayed as tofu
Result PNGs are attached: [Chertezh_V15.pdf.p2103.png-1](/uploads/686b90873540e26d6dbe6ddf0b271d13/Chertezh_V15.pdf.p2103.png-1.png), [Chertezh_V16.pdf.p2103.png-1](/uploads/f2884029cb1e9d57b3cfe47edeb0ee7d/Chertezh_V16.pdf.p2103.png-1.png)
Upd: In my initial message I listed the files in wrong order, maybe that's why I've got "can't reproduce" replies.https://gitlab.freedesktop.org/poppler/poppler/-/issues/1081PDF to SVG conversion keeps EXIF orientation tags in embedded JPEG but should...2021-05-11T17:28:11ZDmitry ShubinPDF to SVG conversion keeps EXIF orientation tags in embedded JPEG but should notSteps to reproduce with poppler 2021.05:
- Convert the attached file [test-with-exif-orientation.pdf](/uploads/10c0a691604e1901645dcad39438b7ae/test-with-exif-orientation.pdf) to SVG using pdftocairo:
```
pdftocairo -svg -l 1 -f 1 test-...Steps to reproduce with poppler 2021.05:
- Convert the attached file [test-with-exif-orientation.pdf](/uploads/10c0a691604e1901645dcad39438b7ae/test-with-exif-orientation.pdf) to SVG using pdftocairo:
```
pdftocairo -svg -l 1 -f 1 test-with-exif-orientation.pdf test-with-exif-orientation.pdf.svg
```
- Open the result in Chrome or Firefox
- Expected: the text on the picture is oriented horizontally
- Actual: the text is oriented vertically: [test-with-exif-orientation.pdf.svg](/uploads/8f8b94dad2413fea99780243eca06680/test-with-exif-orientation.pdf.svg)
[image](/uploads/54a2ce5cf0b1dbc8b91268f801d995c7/image.png)
This PDF contains an embedded JPEG image which has EXIF orientation tag set to a non-default value (6). Adobe Reader, Chrome and other viewers ignore this tag when rendering the PDF; Poppler ignores it as well when converting the file to PNG. However, the tag is preserved in the JPEG image after conversion to SVG, so the browsers see the orientation in the JPEG and rotate the file.https://gitlab.freedesktop.org/poppler/poppler/-/issues/1078Highlight annotations created with no style become black squares2021-05-11T20:29:56ZFrancisco Blas Izquierdo Riera (klondike)Highlight annotations created with no style become black squaresWhen creating highlight annotations using poppler and not providing a style the result is rendered as a black square on some readers (like okular) instead of something more readable.
This issue is directly related to poppler-qt5 and I s...When creating highlight annotations using poppler and not providing a style the result is rendered as a black square on some readers (like okular) instead of something more readable.
This issue is directly related to poppler-qt5 and I suspect also poppler. I'm providing the sample code using python-poppler-qt5 as that was what I was using when I found this bug.
```python
from popplerqt5 import Poppler
import PyQt5
import PyQt5.QtXml
import PyQt5.QtGui
d = Poppler.Document.load('example.pdf')
mdata= [{"page": 62, "text": "example", "pboxes": [ {"h": 16.820983886719, "x": 298.89953613281, "y": 520.43939208984, "w": 29.266296386719 }]}]
for v in mdata['bookmarks'].values():
p=d.page(v['page']-1)
ps = p.pageSizeF()
xfact = ps.width()
yfact = ps.height()
ymin = xmin = 1.
xmax = ymax = 0.
a = Poppler.HighlightAnnotation()
p.addAnnotation(a)
a.setAuthor('Anonymous')
a.setContents(v['text']))
quads = []
for pb in v['pboxes'].values():
x1 = pb['x']/xfact
y1 = pb['y']/yfact
x2 = x1+pb['w']/xfact
y2 = y1+pb['h']/yfact
xmin = min(xmin, x1)
ymin = min(ymin, y1)
xmax = max(xmax, x2)
ymax = max(ymax, y2)
quad = Poppler.HighlightAnnotation.Quad()
quad.points = [PyQt5.QtCore.QPointF(x1,y2), PyQt5.QtCore.QPointF(x2,y2), PyQt5.QtCore.QPointF(x2,y1), PyQt5.QtCore.QPointF(x1,y1)]
quads.append(quad)
a.setBoundary(PyQt5.QtCore.QRectF(xmin,ymin,xmax-xmin,ymax-ymin))
a.setHighlightQuads(quads)
c=d.pdfConverter()
c.setPDFOptions(c.PDFOptions(0|c.WithChanges))
c.setOutputFileName("test.pdf")
c.convert()
```
For now I am addressing this by creating my own style for the annotations, but since the ones I see generated by koreader do not have any style I suspect there is some kind of fool play going on here. In trying to address this I have found some bugs in the annotation handling code but none seemed to fix the issue:
* Once the objects are set many are not removed or reset to a null object afterwards [Annot.patch](/uploads/71ce25cf1c8fd5c25eaab537fd499510/Annot.patch)
* When loading the dasharray from the PDF the invalid 0 count causes an overwrite of the default in poppler-qt5 [poppler-annotation.patch](/uploads/5cb089c23910da92cf7ec16f2b94fd96/poppler-annotation.patch)
* When saving styles, the default dasharray does not override the current style [poppler-annotation2.patch](/uploads/f3c0da92ea43987325ceb19d003cdb10/poppler-annotation2.patch)
I lack enough knowledge about the PDF format or poppler to see what I may be missing here to explain this missbehaviour. With these patches the annotations are still displayed incorrectly and I'm out of ideas where to try (as I don't know how to extract the dictionaries of the annotations that are correctly displayed to compare them with the one poppler is generating).https://gitlab.freedesktop.org/poppler/poppler/-/issues/1076Whitespace changes2021-05-11T22:00:59ZJeroen OomsWhitespace changesI posted about this on the mailing list [earlier this week](https://lists.freedesktop.org/archives/poppler/2021-May/014745.html), somebody replied that I better open an issue here.
I maintain R bindings called pdftools, mostly used for ...I posted about this on the mailing list [earlier this week](https://lists.freedesktop.org/archives/poppler/2021-May/014745.html), somebody replied that I better open an issue here.
I maintain R bindings called pdftools, mostly used for extracting text from scientific documents. The bindings wrap the C++ API, in particular we convert pdf to text using `poppler::page::text()` with physical_layout.
Recently users have started to report changes in behaviour with newer versions of poppler, in particular wrt whitespace. For example, all pages are now terminated end with an `\f` symbol which was not the case before. On Windows, linebreaks are now converted as `\r\n` instead of just '\n' as before (we use mingw-w64 compilers). And also, some documents that would contain a single linebreak in e.g. poppler 0.73, now have 4 or 5 linebreaks on the same place with the latest poppler.
## The \f form-feed character
As of poppler 0.88 all pages end with an `\f` character. This messes up some data pipelines. Below is an example program that I used to bisect (I use [NEWS.pdf](https://cran.r-project.org/doc/manuals/r-release/NEWS.pdf) but it can be any PDF really)
```cpp
#include <poppler-document.h>
#include <poppler-page.h>
#include <iostream>
using namespace std;
using poppler::document;
using poppler::byte_array;
int main(){
document *doc = document::load_from_file(std::string("NEWS.pdf"));
poppler::page *p = doc->create_page(0);
byte_array str = p->text().to_utf8();
if(str.back() == '\f'){
cout << "FOUND EVIL F CHARACTER!\n";
return 1;
}
cout << "DID NOT FIND EVIL F CHARACTER!\n";
return 0;
}
```
The result of the bisect is this commit by @jiri in https://gitlab.freedesktop.org/poppler/poppler/-/merge_requests/526
```
1e098e9b272d57478a3f23a9a6b6bb1542740aaf is the first new commit
commit 1e098e9b272d57478a3f23a9a6b6bb1542740aaf
Author: Jiri Jakes <freedesktop@jirijakes.eu>
Date: Tue Mar 31 21:38:23 2020 +0000
cpp: Add non_raw_non_physical layout for page::text()
```
## Extra linebreaks
The same commit also seems to affect linebreaks. For example if we use the program above to print [NEWS.pdf](https://cran.r-project.org/doc/manuals/r-release/NEWS.pdf))
```cpp
#include <poppler-document.h>
#include <poppler-page.h>
#include <iostream>
using namespace std;
using poppler::document;
using poppler::byte_array;
int main(){
document *doc = document::load_from_file(std::string("NEWS.pdf"));
poppler::page *p = doc->create_page(0);
byte_array buf = p->text().to_utf8();
std::string str(buf.begin(), buf.end());
cout << str;
return 0;
}
```
In poppler 0.87 we see the fist lines:
```
NEWS for R version 4.0.5 (2021-03-31)
NEWS R News
CHANGES IN R 4.0.5
BUG FIXES:
• The change to the internal table in R 4.0.4 for iswprint has been reverted: it con-
tained some errors in printability of ‘East Asian’ characters.
• For packages using ‘LazyData’, R CMD build ignored the ‘--resave-data’ option and
the ‘BuildResaveData’ field of the ‘DESCRIPTION’ file (in R versions 4.0.0 to 4.0.4).
CHANGES IN R 4.0.4
```
However in poppler 0.88 we see:
```
NEWS for R version 4.0.5 (2021-03-31)
NEWS R News
CHANGES IN R 4.0.5
BUG FIXES:
• The change to the internal table in R 4.0.4 for iswprint has been reverted: it con-
tained some errors in printability of ‘East Asian’ characters.
• For packages using ‘LazyData’, R CMD build ignored the ‘--resave-data’ option and
the ‘BuildResaveData’ field of the ‘DESCRIPTION’ file (in R versions 4.0.0 to 4.0.4).
CHANGES IN R 4.0.4
```
On Windows the linebreaks change from `\n` to `\r\n`. I assume this is not intentional?https://gitlab.freedesktop.org/poppler/poppler/-/issues/1080Make boost mandatory or opt-out when building splash2021-05-12T22:49:38ZHubert FiguiereMake boost mandatory or opt-out when building splashThe Splash backend uses `boost::small_vector` for **serious** performance gain. But the dependency is optional opt-in which make most of the packager ignore it, including on major distro.
In a major use case, I dug into why some of the ...The Splash backend uses `boost::small_vector` for **serious** performance gain. But the dependency is optional opt-in which make most of the packager ignore it, including on major distro.
In a major use case, I dug into why some of the PDF upload workflow in the Internet Archive, and the answer being to simply recompile Poppler with boost didn't really fly as their server use Ubuntu and deploying something like that would be little benefit. (this was in 2020, and things could have changed since)
(I'm just a user, but I investigated the issue to see if their was something I could fix in poppler)
If you made this mandatory, or opt-out, when building splash, then the chance of distribution building poppler correctly would increase.
Edit: added that's when building splash.https://gitlab.freedesktop.org/poppler/poppler/-/issues/416Make PDFDoc::setup provide the wasReconstructed value to the caller2021-05-14T22:21:32ZBugzilla Migration UserMake PDFDoc::setup provide the wasReconstructed value to the caller## Submitted by Albert Astals Cid
Assigned to **poppler-bugs**
**[Link to original bug (#75588)](https://bugs.freedesktop.org/show_bug.cgi?id=75588)**
## Description
This way the caller application may chose to show a warning to t...## Submitted by Albert Astals Cid
Assigned to **poppler-bugs**
**[Link to original bug (#75588)](https://bugs.freedesktop.org/show_bug.cgi?id=75588)**
## Description
This way the caller application may chose to show a warning to the user saying something like "The PDF is broken but we're still showing something, contents may not be correct"https://gitlab.freedesktop.org/poppler/poppler/-/issues/541"8" shown instead of "x" inside checkbox when converting LibreOffice-generate...2021-05-22T20:58:12ZBugzilla Migration User"8" shown instead of "x" inside checkbox when converting LibreOffice-generated form to PostScript## Submitted by Michael Weghorn
Assigned to **poppler-bugs**
**[Link to original bug (#107303)](https://bugs.freedesktop.org/show_bug.cgi?id=107303)**
## Description
Created attachment 140724
Sample form generated by LibreOffice
...## Submitted by Michael Weghorn
Assigned to **poppler-bugs**
**[Link to original bug (#107303)](https://bugs.freedesktop.org/show_bug.cgi?id=107303)**
## Description
Created attachment 140724
Sample form generated by LibreOffice
Converting a LibreOffice-generated PDF form with a ticked checkbox to PostScript leads to an "8" being shown inside the check box rather than the expected "x" sign.
Steps to reproduce:
1) Open attached PDF form "simple_form.pdf" in Okular
2) tick the checkbox
3) print (either to a real printer or use "Print to File (PDF)")
4) Look at the output/printout
Result:
An "8" is shown inside of the checkbox that has been ticked.
Expected result:
The same checkmark ("x") as displayed in Okular is shown inside the checkbox on the printout.
This can also be reproduced by directly calling 'pdftops' on a PDF form saved after ticking the checkbox:
$ pdftops simple_form_CHECKBOX_TICKED_CLEANED.pdf
Syntax Error: Unknown font tag 'ZaDb'
Syntax Error: Unknown font tag 'ZaDb'
(In addition to ticking the checkbox, the document has been run through 'mutool clean' to make analysis easier.)
**Attachment 140724**, "Sample form generated by LibreOffice":
[simple_form.pdf](/uploads/0dcb7e1b803e6d4429d083695109d896/simple_form.pdf)https://gitlab.freedesktop.org/poppler/poppler/-/issues/1084pdfimages can't extract PNGs losslessly2021-05-25T20:57:10ZTamás Zaholapdfimages can't extract PNGs losslesslyWhen `pdfimages` is used to extract images in supposedly lossless formats (e.g. PNG), it performs a destructive color space conversion, making it impossible to recover the original pixel data.
Paradoxically, this means that `pdfimages` ...When `pdfimages` is used to extract images in supposedly lossless formats (e.g. PNG), it performs a destructive color space conversion, making it impossible to recover the original pixel data.
Paradoxically, this means that `pdfimages` fares better in recovering JPEGs (which is a lossy format) than PNGs, as the JPEG data from a `DCTDecode`-filtered stream is reproduced as is.
I think `pdfimages` should either:
1. Embed the color profile of the image object in the output PNG. (i.e. an `ICCBased` color profile can simply be embedded in the PNG as an `iCCP` chunk)
1. Warn the user that a destructive color space conversion will take place.