Bug 51903 - [PATCH] RevisionMarkAuthorTable Illegal Length -1 getFromUnicodeLE
Summary: [PATCH] RevisionMarkAuthorTable Illegal Length -1 getFromUnicodeLE
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HWPF (show other bugs)
Version: 3.8-dev
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-28 01:49 UTC by Jeremy
Modified: 2011-10-03 19:21 UTC (History)
0 users



Attachments
Patch for issue (780 bytes, application/octet-stream)
2011-09-28 01:49 UTC, Jeremy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy 2011-09-28 01:49:12 UTC
Created attachment 27618 [details]
Patch for issue

Sporadic bug with some Word files (unable to submit sample due to sensitive nature of files). 

The LittleEndian.getShort sometimes returns a length of -1, which causes a failure in subsequent getFromUnicodeLE() call.  Added a check for invalid length before proceeding.  Was last entry in my test file and having a null entries array value does not appear to cause any additional errors down-stream.


Stack Trace (POI version 3.8-beta4)

Caused by: java.lang.IllegalArgumentException: Illegal length -1
	at org.apache.poi.util.StringUtil.getFromUnicodeLE(StringUtil.java:73)
	at org.apache.poi.hwpf.model.RevisionMarkAuthorTable.<init>(RevisionMarkAuthorTable.java:89)
	at org.apache.poi.hwpf.HWPFDocument.<init>(HWPFDocument.java:375)
	at org.apache.tika.parser.microsoft.WordExtractor.parse(WordExtractor.java:67)
	at org.apache.tika.parser.microsoft.OfficeParser.parse(OfficeParser.java:196)
	at org.apache.tika.parser.CompositeParser.parse(CompositeParser.java:242)
	... 45 more
Comment 1 Sergey Vladimirov 2011-09-30 13:20:02 UTC
I applied patch to SttbUtils and rewrite RevisionMarkAuthorTable to use it. Please, check with r1177644 or later.
Comment 2 Jeremy 2011-10-03 19:21:41 UTC
That appears to have fixed it!!  I'll mark the Bug as resolved.  Thanks very much for your attention to this.



(In reply to comment #1)
> I applied patch to SttbUtils and rewrite RevisionMarkAuthorTable to use it.
> Please, check with r1177644 or later.