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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]