ICEpdf
  1. ICEpdf
  2. PDF-567

Exception decoding FlateDecode stream

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 6.3
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      any

      Description

      The file in question is contains content stream encoded using the FlateDecode filter. ICEpdf currently relies on the java.util.ZipInflaterInputStream to handle the decompression. Unfortunately the ZipInflaterInputStream is chocking on this stream.

      After quite a bit of tracing it became apparent that is was the last ZipInflaterInputStream.read call that was reporting the error. The only way that I could get all the needed content tokens was to set the buffer to 1 byte as a work around. The problem with he 1 byte buffer is that it isn't performant.

        Activity

        Patrick Corless created issue -
        Hide
        Patrick Corless added a comment -

        I've added the system property org.icepdf.core.flateDecode.bufferSize to allow users to set the default buffer size which ~16KB. For large file the buffer could be set higher to improve performance. But for this client they will have to set org.icepdf.core.flateDecode.bufferSize=1 for the the time being.

        Show
        Patrick Corless added a comment - I've added the system property org.icepdf.core.flateDecode.bufferSize to allow users to set the default buffer size which ~16KB. For large file the buffer could be set higher to improve performance. But for this client they will have to set org.icepdf.core.flateDecode.bufferSize=1 for the the time being.
        Hide
        Patrick Corless added a comment -

        Suggesting work around for the time being.

        Show
        Patrick Corless added a comment - Suggesting work around for the time being.
        Patrick Corless made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.0.1 [ 10872 ]
        Resolution Fixed [ 1 ]
        Patrick Corless made changes -
        Support Customer Ref. #s 12113
        Patrick Corless made changes -
        Support Customer Ref. #s 12113
        Arran Mccullough made changes -
        Salesforce Case Reference 5007000000T59dAAAR
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #34438 Thu Apr 18 10:19:59 MDT 2013 patrick.corless PDF-567 added configurable buffer size.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/filters/ChunkingInputStream.java
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/filters/FlateDecode.java
        Hide
        Patrick Corless added a comment -

        Reopening issue with the hope of finding a more performant work around.

        Show
        Patrick Corless added a comment - Reopening issue with the hope of finding a more performant work around.
        Patrick Corless made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Patrick Corless made changes -
        Fix Version/s 5.0.5 [ 11373 ]
        Fix Version/s 5.0.1 [ 10872 ]
        Hide
        Patrick Corless added a comment -

        Re-opened this issue. There are a few open source zip libraries out there that could possible fix this issue and be a little quicker then the default java implementation.

        Show
        Patrick Corless added a comment - Re-opened this issue. There are a few open source zip libraries out there that could possible fix this issue and be a little quicker then the default java implementation.
        Patrick Corless made changes -
        Fix Version/s 5.0.6 [ 11381 ]
        Fix Version/s 5.0.5 [ 11373 ]
        Patrick Corless made changes -
        Fix Version/s 5.0.7 [ 11470 ]
        Fix Version/s 5.0.6 [ 11381 ]
        Patrick Corless made changes -
        Fix Version/s 5.1 [ 10675 ]
        Fix Version/s 5.0.7 [ 11470 ]
        Patrick Corless made changes -
        Fix Version/s 5.2 [ 10970 ]
        Fix Version/s 5.1 [ 10675 ]
        Patrick Corless made changes -
        Fix Version/s 5.2 [ 10970 ]
        Patrick Corless made changes -
        Fix Version/s 6.3 [ 13093 ]
        Hide
        Patrick Corless added a comment -

        I've revisited this on request from a support customer. I've touched up the flate decode to check the stream length and adjust the buffer size appropriately. By default the decode will try and use a rather large 16 KB buffer and will fall back to 2 KB buffer if the stream is really small.

        Show
        Patrick Corless added a comment - I've revisited this on request from a support customer. I've touched up the flate decode to check the stream length and adjust the buffer size appropriately. By default the decode will try and use a rather large 16 KB buffer and will fall back to 2 KB buffer if the stream is really small.
        Patrick Corless made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #52121 Tue Dec 05 09:29:21 MST 2017 patrick.corless PDF-567 patched a rare flate decode issue that was assigning an incorrect
        buffer size for decoding small sized streams.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/core-awt/src/main/java/org/icepdf/core/pobjects/filters/FlateDecode.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #52153 Wed Dec 13 10:53:36 MST 2017 patrick.corless PDF-567 patched a rare flate decode issue that was assigning an incorrect
        buffer size for decoding small sized streams.
        Files Changed
        Commit graph MODIFY /icepdf/branches/icepdf-6.2.0/icepdf/core/src/org/icepdf/core/pobjects/filters/FlateDecode.java
        Judy Guglielmin made changes -
        Support Case References Support Case 14253:- https://icesoft.my.salesforce.com/5000g00001orMCb?srPos=0&srKp=500
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #52213 Tue Jan 16 13:01:53 MST 2018 patrick.corless PDF-567 hopefully a final fix for zip compression corner case we have
        been seeing when a stream does not contain the correct end of steam bytes.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/core-awt/src/main/java/org/icepdf/core/pobjects/filters/FlateDecode.java
        Patrick Corless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Patrick Corless
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: