Hi Albert,

On Sun, Jun 10, 2012 at 6:44 PM, Albert Astals Cid <[email protected]> wrote:
> Hi Hib, I've been having a look at the implementation of
> Hints::getPageObjectNum
>
> int Hints::getPageObjectNum(int page) {
>  if ((page < 1) || (page > nPages)) return 0;
>
>  if (page-1 > pageFirst)
>    return pageObjectNum[page-1];
>  else if (page-1 < pageFirst)
>    return pageObjectNum[page];
>  else
>    return pageObjectNum[0];
> }
>

The idea is that in pageObjectNum[0] you will find the object number
of the page specified as the first page in the linearization table. In
pageObjectNum[1..pageFirst-1] you will find page 1 .. page (pageFirst
-1).
In pageObjectNum[pageFirst.. nPages-1] you will find page
(pageFirst+1) ..  page nPages.

> And i'm quite confused about it since for example if
> nPages = 2
> pageFirst = 3
> page = 2
> (I know probably invalid values, but they could be in a pdf, right)
> it will end up returning pageObjectNum[2] and it would crash.

You are right here in that we assume pageFirst is never larger than
nPages but that is not checked by poppler. Attached patch could fix
this.

Hib

Attachment: 0001-Check-value-of-first-page-in-linearization-table.patch
Description: Binary data

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to