Bug 51903

Summary: [PATCH] RevisionMarkAuthorTable Illegal Length -1 getFromUnicodeLE
Product: POI Reporter: Jeremy <rpi_alum>
Component: HWPFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Patch for issue

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.