Created attachment 64336 [details] testcase % gdb pdftops (gdb) run -origpagesizes /tmp/foo.pdf Starting program: /usr/bin/pdftops -origpagesizes /tmp/foo.pdf Program received signal SIGFPE, Arithmetic exception. 0x00007ffff7cd254a in PSOutputDev::checkPageSlice (this=0x435ba0, page=0x4359b0, rotateA=0, useMediaBox=<optimized out>, crop=false, sliceX=0, sliceY=0, sliceW=0, sliceH=0, printing=true, abortCheckCbk=0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0, annotDisplayDecideCbkData=0x0) at /var/tmp/portage/app-text/poppler-0.20.2/work/poppler-0.20.2/poppler/PSOutputDev.cc:3132 3132 stripeH = (sliceH + nStripes - 1) / nStripes; (gdb) bt #0 0x00007ffff7cd254a in PSOutputDev::checkPageSlice (this=0x435ba0, page=0x4359b0, rotateA=0, useMediaBox=<optimized out>, crop=false, sliceX=0, sliceY=0, sliceW=0, sliceH=0, printing=true, abortCheckCbk=0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0, annotDisplayDecideCbkData=0x0) at /var/tmp/portage/app-text/poppler-0.20.2/work/poppler-0.20.2/poppler/PSOutputDev.cc:3132 #1 0x00007ffff7cbcac3 in Page::displaySlice (this=0x4359b0, out=0x435ba0, hDPI=<optimized out>, vDPI=<optimized out>, rotate=0, useMediaBox=false, crop=true, sliceX=sliceX@entry=-1, sliceY=sliceY@entry=-1, sliceW=sliceW@entry=-1, sliceH=sliceH@entry=-1, printing=true, abortCheckCbk=abortCheckCbk@entry=0, abortCheckCbkData=abortCheckCbkData@entry=0x0, annotDisplayDecideCbk=annotDisplayDecideCbk@entry=0, annotDisplayDecideCbkData=annotDisplayDecideCbkData@entry=0x0) at /var/tmp/portage/app-text/poppler-0.20.2/work/poppler-0.20.2/poppler/Page.cc:507 #2 0x00007ffff7cbccfe in Page::display (this=<optimized out>, out=<optimized out>, hDPI=<optimized out>, vDPI=<optimized out>, rotate=<optimized out>, useMediaBox=<optimized out>, crop=<optimized out>, printing=<optimized out>, abortCheckCbk=0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0, annotDisplayDecideCbkData=0x0) at /var/tmp/portage/app-text/poppler-0.20.2/work/poppler-0.20.2/poppler/Page.cc:450 #3 0x00007ffff7cc22c5 in PDFDoc::displayPages (this=0x434d90, out=0x435ba0, firstPage=<optimized out>, lastPage=1, hDPI=72, vDPI=72, rotate=0, useMediaBox=false, crop=true, printing=true, abortCheckCbk=0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0, annotDisplayDecideCbkData=0x0) at /var/tmp/portage/app-text/poppler-0.20.2/work/poppler-0.20.2/poppler/PDFDoc.cc:483 #4 0x0000000000402840 in main (argc=2, argv=<optimized out>) at /var/tmp/portage/app-text/poppler-0.20.2/work/poppler-0.20.2/utils/pdftops.cc:398 This happens with certain pdfs produced by cups. See: https://bugs.gentoo.org/show_bug.cgi?id=426674 or https://bugs.gentoo.org/show_bug.cgi?id=426552 Started with commit 6ee907f2.
I receive mails already, don't want them twice thanks
In PSOutputDev::startPage, case mode == psModePSOrigPageSizes (line 3524), the initialization of xScale and yScale is missing, should be imo as in the other cases beside psModePS xScale = yScale = 1; (i.e. insert before line 3551) Without it, the calculation of hDPI2 and vDPI2(line 3117 ff) and therefore the calculation of stripes causes this floating point exception. Should I upload a new patch for bug 51982 which includes it, wait that it will be committed and create then a patch here or can You do that, Albert?
Albert?
Wait until i commit the one for 51982, regtesting almost done there, don't want to start again, takes ages :D
Patch for 51982 pushed
Created attachment 64480 [details] [review] solves floating point exception Here now my patch for it. The patch is slightly different to my suggested solution in comment 2 but does the same and is more secure for futur code changes.
Pushed
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.