| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With the file \tests_private\pdf\customer394\problems\normal_994.pdf
the CCITTFaxDecode filter runs off the beginning of the 'lbuf'
buffer at the end of the image data, in invert_data().
This appears to be 'something' to do with returning to the interpreter
for more data, because that seems to decrement the pointer to one byte
before the beginning of the buffer. This may be a red herring.
What is certainly true is that we actually do write one byte of data
to the byte immediately preceding the start of the buffer. The way
the memory manager currently works means that corrupting this byte
does not cause Ghostscript to see any problems. However when running
pdfi with leak detection it writes to the 'padding' of the memory
structure, corrupting it, and causing an error when the buffer is
freed.
We obviously should not be writing to a point before the beginning of
the buffer, but I cannot make head or tail of this code. It is very
complex (needlessly so IMO), makes extensive use of macros, and of
course is wrapped up with the Ghostscript stream code. The result is
all but incomprehensible, even to the original author I suspect!
Throwing an error when we try to write to a point before the beginning
of the buffer causes a number of files to exit with errors that
previously did not, so its clear that there is something up here, and
exiting with an error is not a fix.
So given that I can't understand the code, and a naive fix is
insufficient, this commit works around the problem by allocating slop
at the beginning of the buffer, to match the slop already allocated at
the end of the buffer.
This is complicated by the fact that the code swaps the two buffers
'lbuf' and 'lprev' as it runs, and by the garbage collector which may
relocate the buffers during the decoding.
So in addition to allocating more memory, we need to recalculate the
lpuf and lprev pointers on entry to the process routines, and when the
lbuf and lprev pointers are swapped we need to swap lprevstart and
lbufstart as well.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I have a test file (source unknown) e249869cf6a250726711c21fda42763c_signal_sigsegv_a418b9_5694_4827.pdf
which has a number of type 3 bitmap glyphs with invalid CCITTFaxDecode
parameters. The (optional) Columns key in the dictionary has an
associated value of 2^32-1 in one case and an even larger value in
another.
The new pdfi interpreter causes a seg fault in the CCITTFaxDecoder
because this breaks a 32-bit signed integer on Windows, causing the
'raster' value to be negative, when added to the memory pointer this
causes us to try and read from before the beginning of the data buffer.
Ghostscript's PDF interpreter doesn't trigger this because it fails
much earlier and doesn't try to execute these glyphs but I'm certain
it would be possible to modify the file so that it did.
Adding a simple negative check and throwing an error if it is, resolves
the problem.
|
| |
|
|
|
|
| |
All gotos are now forwards. Hopefully this should assuage LGTM.
|
| |
|
| |
|
|
|
|
|
|
| |
Introduce a PRI_INTPTR and use that to consistently display
pointers. We avoid using %p, as that displays inconsistently
between platforms. Sometimes it does 0x%x, sometimes just %x.
|
|
|
|
|
|
|
|
|
| |
This specifically only applies to the CCITT decode filter at the
moment, but the key will be in place for all image decoders to look
at if required.
A following commit will cause the PDF interpreter to set this key
in the DecodeParms.
|
| |
|
|
|
|
|
|
|
|
|
| |
Also update copyright dates.
Remove gs_cmdl.ps as we no longer use it, and remove its entry from
psfiles.htm.
Remove xfonts.htm as this feature (xfont support) is long, long gone.
|
| |
|
|
Squashed into one commit (see branch for details of the evolution of the
branch).
This brings gpcl6 and gxps into the Ghostscript build system, and a shared
set of graphics library object files for all the interpreters.
Also, brings the same configuration options to the pcl and xps products as we
have for Ghostscript.
|