[poppler] Confused about Hints::getPageObjectNum

Albert Astals Cid aacid at kde.org
Sun Jun 10 09:44:05 PDT 2012


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];
}

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.

Also should be pageFirst used in the returning?

Something like 

  if (page-1 > pageFirst)
    return pageObjectNum[page-1-pageFirst];

?

Cheers,
  Albert



More information about the poppler mailing list