Re: xpdf crashing in OpenBSD 4.5

2009-07-14 Thread Matthias Kilian
On Wed, May 27, 2009 at 06:22:49PM +, Matthew Szudzik wrote:
 I'm using xpdf-3.02pl2p4 with OpenBSD 4.5 on i386, and xpdf is crashing
 on certain pdf files with complex graphics.  For example, the second
 page of
 
  
 http://us.acer.com/acer/wr-resource/3225785014/upload/E0Entity3/5/TravelMate%20family%201-8-08.pdf
 
 causes xpdf to crash, unless the page size is reduced to 50% or smaller.
 Also, the first page of
 
  http://www.shopping.hp.com/shopping/pdf/nm325ua.pdf
 
 causes xpdf to crash if the page size is increased to 200% or greater.

Below is a patch that fixes at least the second one. I took it from
poppler. I'm not sure wether it's the *correct* way to fix it (i'll
also send the diff to Derek to let him decide).

Note that this patch is for -current, but it should apply cleanly
on -4.5, too (except for the pkgname change).

Ciao,
Kili


Repair some out-of-bounds access. From poppler. Fixes at least the
problem with the second pdf file mentioned in
http://marc.info/?l=openbsd-portsm=124344888113151w=2


Index: Makefile
===
RCS file: /cvs/ports/textproc/xpdf/Makefile,v
retrieving revision 1.65
diff -u -p -r1.65 Makefile
--- Makefile30 May 2009 22:35:56 -  1.65
+++ Makefile14 Jul 2009 13:01:46 -
@@ -4,7 +4,7 @@ COMMENT-main=   PDF viewer for X11
 COMMENT-utils= PDF conversion tools
 
 DISTNAME=  xpdf-3.02
-PKGNAME-main=  xpdf-3.02.3p0
+PKGNAME-main=  xpdf-3.02.3p1
 PKGNAME-utils= xpdf-utils-3.02.3
 CATEGORIES=textproc x11
 
Index: patches/patch-splash_SplashXPathScanner_cc
===
RCS file: patches/patch-splash_SplashXPathScanner_cc
diff -N patches/patch-splash_SplashXPathScanner_cc
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/patch-splash_SplashXPathScanner_cc  14 Jul 2009 13:01:46 -
@@ -0,0 +1,31 @@
+$OpenBSD$
+--- splash/SplashXPathScanner.cc.orig  Tue Jul 14 14:43:52 2009
 splash/SplashXPathScanner.cc   Tue Jul 14 14:59:54 2009
+@@ -397,7 +397,7 @@ void SplashXPathScanner::clipAALine(SplashBitmap *aaBu
+   for (; xx + 7 = xx0; xx += 8) {
+ *p++ = 0x00;
+   }
+-  if (xx = xx0) {
++  if (xx  xx0) {
+ *p = 0xff  (xx0  7);
+   }
+   }
+@@ -406,6 +406,9 @@ void SplashXPathScanner::clipAALine(SplashBitmap *aaBu
+   }
+ }
+ xx0 = (*x1 + 1) * splashAASize;
++if (xx0  aaBuf-getWidth()) {
++  xx0 = aaBuf-getWidth();
++}
+ // set [xx, xx0) to 0
+ if (xx  xx0) {
+   p = aaBuf-getDataPtr() + yy * aaBuf-getRowSize() + (xx  3);
+@@ -420,7 +423,7 @@ void SplashXPathScanner::clipAALine(SplashBitmap *aaBu
+   for (; xx + 7 = xx0; xx += 8) {
+   *p++ = 0x00;
+   }
+-  if (xx = xx0) {
++  if (xx  xx0) {
+   *p = 0xff  (xx0  7);
+   }
+ }



xpdf crashing in OpenBSD 4.5

2009-05-27 Thread Matthew Szudzik
I'm using xpdf-3.02pl2p4 with OpenBSD 4.5 on i386, and xpdf is crashing
on certain pdf files with complex graphics.  For example, the second
page of

 
http://us.acer.com/acer/wr-resource/3225785014/upload/E0Entity3/5/TravelMate%20family%201-8-08.pdf

causes xpdf to crash, unless the page size is reduced to 50% or smaller.
Also, the first page of

 http://www.shopping.hp.com/shopping/pdf/nm325ua.pdf

causes xpdf to crash if the page size is increased to 200% or greater.
Can anyone else confirm this behavior?



Re: xpdf crashing in OpenBSD 4.5

2009-05-27 Thread Matthias Kilian
On Wed, May 27, 2009 at 06:22:49PM +, Matthew Szudzik wrote:
 I'm using xpdf-3.02pl2p4 with OpenBSD 4.5 on i386, and xpdf is crashing
 on certain pdf files with complex graphics.  For example, the second
 page of
 
  
 http://us.acer.com/acer/wr-resource/3225785014/upload/E0Entity3/5/TravelMate%20family%201-8-08.pdf
 
 causes xpdf to crash, unless the page size is reduced to 50% or smaller.
 Also, the first page of
 
  http://www.shopping.hp.com/shopping/pdf/nm325ua.pdf
 
 causes xpdf to crash if the page size is increased to 200% or greater.
 Can anyone else confirm this behavior?

On -current (with xpdf-3.02.3), the first file displays fine, the
second one causes segfaults. I'll have a closer look at it.

You could also try to build the backport from Ian McWilliam:
http://marc.info/?l=openbsd-portsm=124092467225494w=2

If all else fails, try one of the other pdf viewer, like epdfview
or evince. (these days, i've more trust in the poppler developers
than in the xpdf developer, though both handle critical bugs in a
very messy way)

Ciao,
Kili

ps: i've still some M's for other ports including xpdf sources
(texlive, kdegraphics, koffice is a hopeless case) and i didn't get
any feedback yet, except one i trust you from landry (IIRC). Well,
don't trust me -- test!



Re: xpdf crashing in OpenBSD 4.5

2009-05-27 Thread Predrag Punosevac
Matthias Kilian k...@outback.escape.de wrote:

 On Wed, May 27, 2009 at 06:22:49PM +, Matthew Szudzik wrote:
  I'm using xpdf-3.02pl2p4 with OpenBSD 4.5 on i386, and xpdf is crashing
  on certain pdf files with complex graphics.  For example, the second
  page of
  
   
  http://us.acer.com/acer/wr-resource/3225785014/upload/E0Entity3/5/TravelMate%20family%201-8-08.pdf
  
  causes xpdf to crash, unless the page size is reduced to 50% or smaller.
  Also, the first page of
  
   http://www.shopping.hp.com/shopping/pdf/nm325ua.pdf
  
  causes xpdf to crash if the page size is increased to 200% or greater.
  Can anyone else confirm this behavior?

 On -current (with xpdf-3.02.3), the first file displays fine, the
 second one causes segfaults. I'll have a closer look at it.

 You could also try to build the backport from Ian McWilliam:
 http://marc.info/?l=openbsd-portsm=124092467225494w=2

 If all else fails, try one of the other pdf viewer, like epdfview
 or evince. (these days, i've more trust in the poppler developers
 than in the xpdf developer, though both handle critical bugs in a
 very messy way)

 Ciao,
   Kili

 ps: i've still some M's for other ports including xpdf sources
 (texlive, kdegraphics, koffice is a hopeless case) and i didn't get
 any feedback yet, except one i trust you from landry (IIRC). Well,
 don't trust me -- test!

I still use xpdf-3.02pl2p4 on 4.4. amd64. I can not reproduce Matthew's
claims with the pdf documents he proposed. Xpdf renders them rock
stable. So something must have been messed up probably upstream with 
the new version.  
Best,
Predrag



Re: xpdf crashing in OpenBSD 4.5

2009-05-27 Thread Matthias Kilian
On Wed, May 27, 2009 at 04:18:22PM -0400, Predrag Punosevac wrote:
 I still use xpdf-3.02pl2p4 on 4.4. amd64. I can not reproduce Matthew's
 claims with the pdf documents he proposed. Xpdf renders them rock
 stable. So something must have been messed up probably upstream with 
 the new version.  

Matthew is using the same version, but on 4.5. Changes made to the
xpdf port between 4.4 and 4.5 touch the packaging, disable the DRM
bullshit and add some security fixes.

If some of the diffs introduced the failure, it must be one of those
security fixes. However, I had some PDFs causing crashes with an
older version of xpdf randomly, i.e. sometimes it seemed to work,
sometimes i got segfaults. The failure rate did depend on the window
size of xpdf, on actions like resizing the window, and on the window
manager used.

So you may see the bug if you just try harder ;-)

nb: i get segfaults for the second file mentioned by Matthew on
both i386 and amd64.

Ciao,
Kili



Re: xpdf crashing in OpenBSD 4.5

2009-05-27 Thread Matthew Weigel
On Wed, 27 May 2009 22:47:37 +0200, Matthias Kilian
k...@outback.escape.de
wrote:

 So you may see the bug if you just try harder ;-)

I was seeing crashes on xpdf on 4.4, but then I can remember seeing crashes
on xpdf for a long time, pretty much every OS that I used it on.  So I just
switched to another reader, so I just started using epdfview when I saw it
again...
-- 
 Matthew Weigel
 hacker
 unique  idempot . ent



Re: xpdf crashing in OpenBSD 4.5

2009-05-27 Thread Predrag Punosevac
Matthias Kilian k...@outback.escape.de wrote:

 So you may see the bug if you just try harder ;-)


 Ciao,
   Kili
Kili,

I did play with epdfview and gv and various pdf files inspired by 
your exchange with Matt. 

Epdfview full screen mode doesn't play nice with CWM. It will just 
remove the border but would not increase to full screen. Moreover 
epdfview has problems with rendering Powerdot LaTeX class of 
presentations. It might be even Poppler bug since I see Ocular people
complaining about similar issue on KDE list. 

http://mail.kde.org/pipermail/okular-devel/2009-May/003706.html

In collusion Epdfview is useless for laptop presentations at least for
me. 

GV can not even open slides properly. It rotates them 90 degrees. So 
again it is useless for more than viewing simple PDF documents. I 
use GV normally as a PostScript viewer since renders pages nicer than
GVU of SIAG suite which I use for spreadsheets.


Buggy or not I am sticking with old trusted Xpdf when it comes to PDF.

Best,
Predrag