Allow extra whitespace/newlines after stream tokens (Issue #40)

This commit is contained in:
Michael R Sweet
2023-10-02 05:06:33 -04:00
parent 6a4ce57d09
commit a83f7f50ff
3 changed files with 15 additions and 2 deletions

View File

@ -420,6 +420,9 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
}
ptr += 3;
while (*ptr && isspace(*ptr & 255))
ptr ++;
_pdfioFileConsume(obj->pdf, (size_t)(ptr - line));
// Then grab the object value...
@ -438,11 +441,14 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
return (false);
}
if (tb.bufptr && tb.bufptr < tb.bufend && (*(tb.bufptr) == 0x0d || *(tb.bufptr) == 0x0a))
tb.bufptr ++; // Skip trailing CR or LF after token
_pdfioTokenFlush(&tb);
if (!strcmp(line, "stream"))
{
// Yes, save its location...
// Yes, this is an embedded stream so save its location...
obj->stream_offset = _pdfioFileTell(obj->pdf);
PDFIO_DEBUG("_pdfioObjLoad: stream_offset=%lu.\n", (unsigned long)obj->stream_offset);
}