Bug 56138

Summary: Index out of range exception in CodePageString
Product: POI Reporter: Jon Iles <jon.iles>
Component: HPSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.10-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Test case to reproduce the problem

Description Jon Iles 2014-02-14 13:03:47 UTC
Created attachment 31313 [details]
Test case to reproduce the problem

An index out of range exception is thrown in CodePageString when reading a PropertySet from a Microsoft Project MPP file.

I have attached a test case which reproduces the issue. The fix for the issue is to change line 45 of CodePageString.java to add a test for zero length strings:

Before:
if ( _value[size - 1] != 0 ) {

After:
if ( size != 0 && _value[size - 1] != 0 ) {
Comment 1 Nick Burch 2014-02-16 19:40:15 UTC
Thanks for this! I've applied your patch, along with a slightly altered version of the unit test in r1568813.