poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54925] New: [PATCH] StyleTextPropAtom incorrect text size causes StringIndexOutOfBoundsException in RichTextRun.getText()
Date Fri, 03 May 2013 20:35:37 GMT

            Bug ID: 54925
           Summary: [PATCH] StyleTextPropAtom incorrect text size causes
                    StringIndexOutOfBoundsException in
           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

View raw message