oc-rtf: control words can also have a space before next tag

This was causing to parse a single space as an empty control
word with length 0, which was the source of several crashes.

Example:

  \f0\fbidi \fcharset0
   --------^

font index is 0, font family is bidi but when parsing charset we were
assuming control word was '' instead of 'charset0'.

This only fixes the crashes, the parseFontTable function works quite
awful right now.
pull/69/head
Jesús García Sáez 2014-08-25 18:27:11 +02:00 committed by Julio García
parent a7c2054cce
commit 05578bfcb6
1 changed files with 5 additions and 4 deletions

View File

@ -412,16 +412,17 @@ const unsigned short ansicpg874[256] = {
- (const char *) parseControlWord: (unsigned int *) len
{
const char *start, *end;
start = ADVANCE;
while (isalnum(*_bytes) || *_bytes == '-')
while (isalnum(*_bytes) || *_bytes == '-' || isspace(*_bytes))
{
ADVANCE;
}
end = _bytes;
*len = end-start-1;
return start+1;
}