File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
RTF Parser Kit/src/com/rtfparserkit/parser/raw Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,22 @@ private void handleCharacterByte(int ch) throws IOException
135135 {
136136 throw new IllegalStateException ("Unexpected end of file" );
137137 }
138- b += HexUtils .parseHexDigit (ch );
138+
139+ // Have encountered malformed RTF where only a single hex digit
140+ // has been supplied. e.g. \'AA\'B\'CC so we hit the next \
141+ // rather than getting a hex digit. Try to handle this specific
142+ // case gracefully by unreading the next character and working with
143+ // the single digit we have.
144+ if (ch == '\\' )
145+ {
146+ b = b >> 4 ;
147+ source .unread (ch );
148+ }
149+ else
150+ {
151+ b += HexUtils .parseHexDigit (ch );
152+ }
153+
139154 buffer .add (b );
140155 parsingHex = false ;
141156 }
You can’t perform that action at this time.
0 commit comments