By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release.

Bug 1175

Summary: xpdf is not updated with latest sources
Product: TDE Reporter: Darrell <darrella>
Component: tdegraphicsAssignee: Timothy Pearson <kb9vqf>
Status: NEW ---    
Severity: normal CC: bugwatch, darrella, mutantturkey, slavek.banko
Priority: P1    
Version: R14.0.x [Trinity]   
Hardware: Other   
OS: Linux   
Compiler Version: TDE Version String:
Application Version: Application Name:
Bug Depends on:    
Bug Blocks: 2968    
Attachments: Gentoo kpdf/xpdf patch from 2009
xpdf patch
xpdf-3.02pl4.patch
xpdf-3.02pl5.patch
xpdf-errCodes proposed patch

Description Darrell 2012-08-17 15:23:40 CDT
The tdegraphics package uses an internal copy of xpdf from the GIT tree. These internal xpdf sources have not been updated with any security patches.

The latest xpdf release is 3.03.
Comment 1 ktbz.aoneshot.eliddell 2012-08-17 19:34:33 CDT
Created attachment 787 [details]
Gentoo kpdf/xpdf patch from 2009

Adding a patch from Gentoo kde-sunset which, while not quite up to the current version of xpdf, appears to contain some security fixes.  If the xpdf code in the Trinity tree hasn't been altered (why would it have been?), this should apply as-is.  Now we just need changes that took place between xpdf 3.02p14 and 3.03
Comment 2 Darrell 2012-08-18 09:10:12 CDT
Yesterday I tinkered with the xpdf patches from Slackware. Some merged and some did not. Of those that did not, I need to review the source code of the GIT version of xpdf and the original upstream 3.02. I know that at least one of the patches failed because the GIT version was already patched.

Things got confusing as the night wore on and I got tired. Then I realized the GIT version of xpdf is code for the rendering engine only and not the full xpdf package. I'll hack at this some more and post a final patch for testing.

I looked at the 3.03 sources and although only a minor version bump, there sure seems to be a lot different. I'll work on 3.02 patches for the GIT sources. Updating the GIT sources to 3.03 will require effort to prune the code to the rendering engine only, not to mention lots of testing both with compiling and usability testing.
Comment 3 Darrell 2012-08-18 10:05:09 CDT
Created attachment 788 [details]
xpdf patch
Comment 4 Darrell 2012-08-18 10:05:33 CDT
Created attachment 789 [details]
xpdf-3.02pl4.patch
Comment 5 Darrell 2012-08-18 10:05:54 CDT
Created attachment 790 [details]
xpdf-3.02pl5.patch
Comment 6 Darrell 2012-08-18 10:07:23 CDT
This did not turn out too bad. Looks like patches xpdf-3.02pl1 -> xpdf-3.02pl3 have been applied to the GIT version. I have attached three upstream patches:

xpdf-resizefix.diff
xpdf-3.02pl4.patch
xpdf-3.02pl5.patch

There were no build failures. Preliminary usability testing shows no problems either, but somebody who actually understands the code in the patches would know exactly what to test.

I have not looked into updating the GIT sources to xpdf 3.03. If somebody else would test these patches and there are no problems, then that would be sufficient to close this bug report after pushing to GIT.
Comment 7 Darrell 2012-08-18 10:48:45 CDT
Although updating to xpdf 3.03 is not strictly required to close this bug report, updating to that version would be nice because xpdf 3.03 supports PDF 1.7.

xpdf-3.03 sources:

ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.03.tar.gz
Comment 8 Timothy Pearson 2012-08-18 15:58:03 CDT
Correct me if I am wrong, but shouldn't the update be as simple as copy+pasting the new source files over the old ones?
Comment 9 Darrell 2012-08-18 19:34:10 CDT
If you are referring to the 3.03 code, been there done that. Build failures in kpdf/core/generator_pdf.
Comment 10 Slávek Banko 2012-08-22 08:12:17 CDT
I tested in v3.5.13-sru kpdf with patches:

+ xpdf-resizefix.diff
+ xpdf-3.02pl4.patch
+ xpdf-3.02pl5.patch

...and I did not find any problems.
Comment 11 Timothy Pearson 2012-08-22 12:45:39 CDT
I recommend that we push the patches to GIT, but rename this bug report to "xpdf is not updated with latest sources" and leave it open as a to-do normal priority bug.
Comment 12 Darrell 2012-08-22 13:08:02 CDT
Patches pushed to GIT in commit 561d1d68.

Bug report bumped to Normal and the Summary edited to update the xpdf sources.
Comment 13 Slávek Banko 2012-08-22 15:34:59 CDT
Only now I realize: splashErrZeroImage and splashErrBadArg has the same error code == returned code can not be distinguished.

I do not know who splashErrZeroImage added, but if not exists in the original xpdf, should be relegated to the end and the number increased to 10.
Comment 14 Darrell 2012-08-22 18:39:57 CDT
The original unpatched xpdf 3.02 does not have splashErrZeroImage or splashErrBadArg.

3.5.10 -> 3.5.13 tdegraphics/kpdf/xpdf/splash/SplashErrorCodes.h has splashErrZeroImage.

Patch xpdf-3.02pl4.patch added splashErrBadArg but the patch does not match the expected code. I don't know how the patch merged. Weird.

I presume all error codes should be different? In that case changing splashErrBadArg to 10 would make sense.
Comment 15 Slávek Banko 2012-08-22 18:48:06 CDT
Created attachment 794 [details]
xpdf-errCodes proposed patch

I propose to move TDE specific error code bellow to the original xpdf error codes.
Comment 16 Darrell 2012-08-22 19:31:27 CDT
Looks sane to me, but I'm not a C/C++ programmer.
Comment 17 Slávek Banko 2012-08-24 21:56:51 CDT
I looked at the source code xpdf 3.03, that does not contain splashErrZeroImage, but neither splashErrBadArg. There is no need to change their order - just splashErrBadArg increase to 10. Because this change can not interfere with the function, so I'll do it.
Comment 18 Slávek Banko 2012-08-24 22:04:49 CDT
Comment on attachment 794 [details]
xpdf-errCodes proposed patch

Error codes numbers fixed in GIT hash 809db41f
Comment 19 Darrell 2013-04-11 19:34:49 CDT
The previous patches were all committed some time ago. All that remains with this report is updating to the 3.03 sources.