Index: StyleTextPropAtom.java =================================================================== --- StyleTextPropAtom.java (revision 1477896) +++ StyleTextPropAtom.java (working copy) @@ -274,6 +274,8 @@ while(pos < rawContents.length && textHandled < prsize) { // First up, fetch the number of characters this applies to int textLen = LittleEndian.getInt(rawContents,pos); + if (textHandled + textLen > (size+1)) + textLen = (size+1) - textHandled; textHandled += textLen; pos += 4; @@ -309,6 +311,8 @@ while(pos < rawContents.length && textHandled < chsize) { // First up, fetch the number of characters this applies to int textLen = LittleEndian.getInt(rawContents,pos); + if (textHandled + textLen > (size+1)) + textLen = (size+1) - textHandled; textHandled += textLen; pos += 4;