mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-07-18 23:09:49 +02:00
Update the token reading code to protect against obvious format abuses.
Update the xref loading code to protect against looping xref tables.
This commit is contained in:
13
pdfio-file.c
13
pdfio-file.c
@ -2091,8 +2091,19 @@ load_xref(
|
||||
PDFIO_DEBUG_VALUE(&trailer);
|
||||
PDFIO_DEBUG("\n");
|
||||
|
||||
if ((xref_offset = (off_t)pdfioDictGetNumber(trailer.value.dict, "Prev")) <= 0)
|
||||
off_t new_offset = (off_t)pdfioDictGetNumber(trailer.value.dict, "Prev");
|
||||
|
||||
if (new_offset <= 0)
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
else if (new_offset == xref_offset)
|
||||
{
|
||||
_pdfioFileError(pdf, "Recursive xref table.");
|
||||
return (false);
|
||||
}
|
||||
|
||||
xref_offset = new_offset;
|
||||
}
|
||||
|
||||
// Once we have all of the xref tables loaded, get the important objects and
|
||||
|
Reference in New Issue
Block a user