Hi,
this is a follow-up on PDFBOX-4778.
The pdf govdocs1/444/444988.pdf contains a broken stream with a lot of broken
matrix operations. Many of them have to few or to much operands, the later are
simply skipped. In the end this leads to illegal results when concatenating
matrices and a very long, maybe endless time of rendering.
PDFBOX-4778 added an additional check of the result which throws an unchecked
exception if any of the matrix elements is either infinite or NaN, so that in
the end the rendering simply stops.
Tilman proposes in the 2.0.19 thread to catch the exception in
org.apache.pdfbox.contentstream.operator.state.Concatenate.process() and, I
guess, to continue processing.
IMHO that won't really work for different reasons:
- there are several other places in the code where the exception might occur
- once the exception is thrown the resulting matrix is broken as at least one
element is infinite or NaN and will lead to even more broken matrix values
Instead of throwing an exception my first idea was to replace such illegal
values with legal ones, but which ones? NaN with 0 and infinite with MAX? Or
maybe replacing the whole resulting matrix with one of the input matrices or
with an identity matrix?
Do you see any more or less reasonable approach to avoid the exception?
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]