Tilman Hausherr created PDFBOX-6159:
---------------------------------------

             Summary: symInRefSize not respected in Huffmann decoding variant
                 Key: PDFBOX-6159
                 URL: https://issues.apache.org/jira/browse/PDFBOX-6159
             Project: PDFBox
          Issue Type: Sub-task
          Components: JBIG2
    Affects Versions: 3.0.4 JBIG2
            Reporter: Tilman Hausherr
            Assignee: Tilman Hausherr
             Fix For: 3.0.5 JBIG2


After not progressing with Huffmann related problems (and working on 
bitmap-symbol-symhuffrefine-textrefine.jbig2), I had a look at the code by Nico 
Weber
https://github.com/SerenityOS/serenity/blob/master/Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp#L1560

he reads symInRefSize bytes into a buffer after reading the size. The oiginal 
levigo code just decodes and ignores the value, i.e. assumes that it will land 
at the correct position.

Thus the start position in my recent change should be another one than the one 
I assumed (after debugging "good" results), but then many that worked now 
failed like this:

    Refinement bitmap bytes expected: 28, bytes read: 26

So either all these reads are wrong (although look ok), or the amount of bytes 
reserved is slightly too high, which is harmless.
Thus I'll change it so that it checks only for an "overshoot" and seeks to the 
correct position after read.

And suddenly lots of files were rendered properly!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to