ICEpdf
  1. ICEpdf
  2. PDF-435

EmptyStackException: org.icepdf.core.util.ContentParser.parseText

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.3.2
    • Fix Version/s: 4.3.3
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      All
    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      float f6 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();
                          float f5 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();
                          float f4 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();
                          float f3 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();
                          float f2 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();
                          float f1 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();
      Show
      float f6 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();                     float f5 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();                     float f4 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();                     float f3 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();                     float f2 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();                     float f1 = stack.isEmpty() ? 0 : ((Number) stack.pop()).floatValue();

      Description

      /**
                       * Tranformation matrix
                       * tm = |f1 f2 0|
                       * |f3 f4 0|
                       * |f5 f6 0|
                       */
                      else if (nextToken.equals(PdfOps.Tm_TOKEN)) {
      // collectTokenFrequency(PdfOps.Tm_TOKEN);
                          shift = 0;
                          previousAdvance = 0;
                          advance.setLocation(0, 0);

                          //EmptyStackException if the stack is empty.
                          float f6 = ((Number) stack.pop()).floatValue(); // mab
                          float f5 = ((Number) stack.pop()).floatValue();
                          float f4 = ((Number) stack.pop()).floatValue();
                          float f3 = ((Number) stack.pop()).floatValue();
                          float f2 = ((Number) stack.pop()).floatValue();
                          float f1 = ((Number) stack.pop()).floatValue();
                          AffineTransform af = new AffineTransform(textBlockBase);

        Activity

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

        Can you post a sample file that demonstrates this issue? I'm concerned they might be a different type of parsing error occurring here.

        Show
        Patrick Corless added a comment - Can you post a sample file that demonstrates this issue? I'm concerned they might be a different type of parsing error occurring here.
        Hide
        Wen Wu added a comment -

        The page 5 is empty.
        I found the EmptyStackException at the ContentParser.parseText.

        Show
        Wen Wu added a comment - The page 5 is empty. I found the EmptyStackException at the ContentParser.parseText.
        Wen Wu made changes -
        Field Original Value New Value
        Attachment bill.pdf [ 14471 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #29213 Mon May 28 12:00:03 MDT 2012 patrick.corless PDF-435 reworked how we parse out the tm token for a malformed stream that does not contain the correct number of transforms numbers. Failry low risk parser change that shouldn't affect speed.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/util/ContentParser.java
        Hide
        Patrick Corless added a comment -

        The PDF has a mailformed line which is though the content parser off:

        f 1 0 0 1 BT 40.79 233.75 Tm (CURRENT CHARGES) Tj

        There is a sudo random "BT" token added to the line above and is causing our content parser some grief.

        I"ll apply a patch that still tries to get the correct text transform matrix, otherwise "CURRENT CHARGES" will be written in the incorrect spot.l

        Show
        Patrick Corless added a comment - The PDF has a mailformed line which is though the content parser off: f 1 0 0 1 BT 40.79 233.75 Tm (CURRENT CHARGES) Tj There is a sudo random "BT" token added to the line above and is causing our content parser some grief. I"ll apply a patch that still tries to get the correct text transform matrix, otherwise "CURRENT CHARGES" will be written in the incorrect spot.l
        Hide
        Patrick Corless added a comment -

        Targeting 4.3.3

        Show
        Patrick Corless added a comment - Targeting 4.3.3
        Patrick Corless made changes -
        Salesforce Case []
        Fix Version/s 4.3.3 [ 10333 ]
        Hide
        Patrick Corless added a comment -

        Closing issue. Updated parser with a slightly different approach then above. The fix insures that the identity matrix is created and is back filled with numbers popped of the stack until the stack is empty.

        Show
        Patrick Corless added a comment - Closing issue. Updated parser with a slightly different approach then above. The fix insures that the identity matrix is created and is back filled with numbers popped of the stack until the stack is empty.
        Patrick Corless made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Patrick Corless made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved: