You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/05/03 22:35:37 UTC

[Bug 54925] New: [PATCH] StyleTextPropAtom incorrect text size causes StringIndexOutOfBoundsException in RichTextRun.getText()

https://issues.apache.org/bugzilla/show_bug.cgi?id=54925

            Bug ID: 54925
           Summary: [PATCH] StyleTextPropAtom incorrect text size causes
                    StringIndexOutOfBoundsException in
                    RichTextRun.getText()
           Product: POI
           Version: 4.0-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSLF
          Assignee: dev@poi.apache.org
          Reporter: dustin@virtualroadside.com
    Classification: Unclassified

Created attachment 30253
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30253&action=edit
Patch that truncates text size if it's larger than the parent

In some of my PPT files (which unfortunately I can't post), the
StyleTextPropAtom contains paragraph and character runs which have incorrect
text sizes in them (e.g., they are much larger than the parent text atom). A
warning is logged ("Problem reading paragraph style runs: ... "), but because
the incorrect text size is stored in the text properties, a
StringIndexOutOfBoundsException is thrown when calling RichTextRun.getText().
Examination shows that it is calling substring on the parent text without
validating the actual text length. 

I wasn't able to create a standalone file with this type of problem in it. The
files that I do have all validate correctly with Microsoft's binary file format
checker, and Microsoft Office is able to open them also without any complaints.
The files do have additional warnings saying "Found a TextHeaderAtom not
followed by a TextBytesAtom or TextCharsAtom: followed by 4002", but I don't
feel this is related. 

The attached patch fixes this problem by modifying StyleTextPropAtom to
truncate the text size if it is larger than the parent text size. This fixes my
problem, passes all current unit tests.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 54925] [PATCH] StyleTextPropAtom incorrect text size causes StringIndexOutOfBoundsException in RichTextRun.getText()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54925

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #2 from Nick Burch <ap...@gagravarr.org> ---
Hopefully fixed in r1496520, but without a unit test it's hard to be sure -
could you confirm please?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 54925] [PATCH] StyleTextPropAtom incorrect text size causes StringIndexOutOfBoundsException in RichTextRun.getText()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54925

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
4002 is a BaseTextPropAtom, which we don't currently have support for. As of
r1496518 we should no longer give a warning for this. 

If you have a file handy that showed this, any chance you could share it, or at
least the list of records around the BaseTextPropAtom? I'm interested to know
if it goes in instead of a StyleTextPropAtom, or before it, as that would
affect our detection logic

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 54925] [PATCH] StyleTextPropAtom incorrect text size causes StringIndexOutOfBoundsException in RichTextRun.getText()

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54925

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
Should be fixed, but unconfirmed for some time, therefore setting to RESOLVED,
please reopen if this is still a problem with current builds.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org