2019-09-12 23:40:16 +03:00
|
|
|
{ enableGUI ? true
|
|
|
|
, enablePDFtoPPM ? true
|
|
|
|
, enablePrinting ? true
|
2021-01-11 10:54:33 +03:00
|
|
|
, lib, stdenv, fetchzip, cmake, makeDesktopItem
|
2019-09-12 23:40:16 +03:00
|
|
|
, zlib, libpng, cups ? null, freetype ? null
|
|
|
|
, qtbase ? null, qtsvg ? null, wrapQtAppsHook
|
2005-12-03 01:49:51 +03:00
|
|
|
}:
|
|
|
|
|
2018-03-02 00:40:10 +03:00
|
|
|
assert enableGUI -> qtbase != null && qtsvg != null && freetype != null;
|
2005-12-03 01:49:51 +03:00
|
|
|
assert enablePDFtoPPM -> freetype != null;
|
2019-09-12 23:40:16 +03:00
|
|
|
assert enablePrinting -> cups != null;
|
2005-11-28 00:06:08 +03:00
|
|
|
|
2019-09-12 23:40:16 +03:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "xpdf";
|
xpdf: 4.04 -> 4.05
Fixes a bunch of CVEs (but not all of them apparently).
Changes:
https://forum.xpdfreader.com/viewtopic.php?t=43343
```
4.05 (2024-feb-08)
------------------
Added the '-overwrite' option to pdftohtml.
Added the 'ignoreWrongSizeToUnicode' xpdfrc setting.
Added the loadSession and saveSession commands, and the 'Load last
session' menu item.
Added code to automatically save and restore the xpdf session under
control of a session manager. This has not been thoroughly tested
yet.
Added the zoomScaleFactor xpdfrc setting.
Added the zoomValues xpdfrc setting.
Added a 'smart case' option for search in xpdf.
Added the '-custom' flag to pdfinfo.
Added a color/gray/mono switch to the 'save image' dialog.
Added the separateRotatedText xpdfrc setting.
Added the '-meta' flag to pdftohtml.
Added the allowLinksToChangeZoom xpdfrc setting.
Added the 'uses JavaScript' output to pdfinfo.
Implemented pattern stroking of text. Also fixed the various
combinations of filling/stroking with color/pattern + clipping, some
of which weren't being handled correctly.
Pdftops now (re)compresses any uncompressed or RLE-compressed images.
On an out-of-memory error, the command line tools now exit with an
"out of memory" message, rather than an exception message.
Add code to pdfimages to extract images from tiling patterns.
Pdftops can now embed external 8-bit OpenType CFF fonts.
Fixed a corner case in the text extractor related to characters drawn
at extremely large coordinates. [Thanks to elvadisas for the bug
report.]
Fixed an integer overflow in the transparency group code. [Thanks to
elvadisas for the bug report.]
Modify Annots::Annots() to skip annotations that have been turned into
AcroFormFields -- invalid Widget-type annots will now be rendered as
annots.
Added a missing integer overflow check in the JBIG2 decoder. [Thanks
to sangjun for the bug report.]
Added some sanity checks to the JBIG2 decoder. [Thanks to sangjun and
ycdxsb for the bug reports.]
Tiling patterns that use non-Normal blend modes can't be cached.
Fixed a bitmap size sanity check in the JBIG2 decoder. [Thanks to Han
Zheng (NCNIPC of China, Hexhive), for the bug report.]
Fixed a missing bounds check in FoFiType1C::convertToOpenType (used in
pdftohtml). [Thanks to cyth for the bug report.]
Fixed a use-after-free bug in pdftohtml. [Thanks to FeRDNYC for the
bug report.]
Merged aconf2.h into aconf.h; corrected the cmake config settings for
paths; added the BASE14_FONT_DIR config option. [Thanks to FeRDNYC
for the suggestions.]
Fixed a missing check for a zero-length index in the CFF (Type1C) font
parser. [Thanks to Yuhang Huang (NCNIPC of China), Han Zheng
(NCNIPC of China, Hexhive), Wanying Cao, Jiayu Zhao (NCNIPC of
China) for the bug report.]
Add an object loop check to Catalog::countPageTree().
The DCT decoder wasn't checking for an SOF before the first SOS.
[Thanks to cyth for the bug report.]
The inline image decoder was skipping to end-of-stream in the wrong
stream object. [Thanks to cyth for the bug report.]
Fixed a bug in the JPEG 2000 decoder when nLayers > 1 and the
'termination on each coding pass' flag is set.
Removed the #pragma interface/implementation stuff (which is outdated
and useless at this point).
Fixed a bug in the ICCBased color space parser that was allowing the
number of components to be zero. (CVE-2023-2662) [Thanks to
huckleberry for the bug report.]
Added checks for PDF object loops in AcroForm::scanField()
(CVE-2018-7453, CVE-2018-16369, CVE-2022-36561, CVE-2022-41844),
Catalog::readPageLabelTree2() (CVE-2023-2663), and
Catalog::readEmbeddedFileTree() (CVE-2023-2664).
The zero-width character problem can also happen if the page size is
very large -- that needs to be limited too, the same way as
character position coordinates. (CVE-2023-3044) [Thanks to jlinliu
for the bug report.]
Add some missing bounds check code in DCTStream. [Thanks to Jiahao
Liu for the bug report.]
Fix a deadlock when an object stream's length field is contained in
another object stream. (CVE-2023-3436) [Thanks to Jiahao Liu for
the bug report.]
Correctly handle tiling patterns with negative step values.
Ignore overprint in soft masks (to match Adobe's behavior).
```
2024-02-11 19:59:03 +03:00
|
|
|
version = "4.05";
|
2012-08-17 00:31:44 +04:00
|
|
|
|
2019-09-12 23:40:16 +03:00
|
|
|
src = fetchzip {
|
xpdf: 4.04 -> 4.05
Fixes a bunch of CVEs (but not all of them apparently).
Changes:
https://forum.xpdfreader.com/viewtopic.php?t=43343
```
4.05 (2024-feb-08)
------------------
Added the '-overwrite' option to pdftohtml.
Added the 'ignoreWrongSizeToUnicode' xpdfrc setting.
Added the loadSession and saveSession commands, and the 'Load last
session' menu item.
Added code to automatically save and restore the xpdf session under
control of a session manager. This has not been thoroughly tested
yet.
Added the zoomScaleFactor xpdfrc setting.
Added the zoomValues xpdfrc setting.
Added a 'smart case' option for search in xpdf.
Added the '-custom' flag to pdfinfo.
Added a color/gray/mono switch to the 'save image' dialog.
Added the separateRotatedText xpdfrc setting.
Added the '-meta' flag to pdftohtml.
Added the allowLinksToChangeZoom xpdfrc setting.
Added the 'uses JavaScript' output to pdfinfo.
Implemented pattern stroking of text. Also fixed the various
combinations of filling/stroking with color/pattern + clipping, some
of which weren't being handled correctly.
Pdftops now (re)compresses any uncompressed or RLE-compressed images.
On an out-of-memory error, the command line tools now exit with an
"out of memory" message, rather than an exception message.
Add code to pdfimages to extract images from tiling patterns.
Pdftops can now embed external 8-bit OpenType CFF fonts.
Fixed a corner case in the text extractor related to characters drawn
at extremely large coordinates. [Thanks to elvadisas for the bug
report.]
Fixed an integer overflow in the transparency group code. [Thanks to
elvadisas for the bug report.]
Modify Annots::Annots() to skip annotations that have been turned into
AcroFormFields -- invalid Widget-type annots will now be rendered as
annots.
Added a missing integer overflow check in the JBIG2 decoder. [Thanks
to sangjun for the bug report.]
Added some sanity checks to the JBIG2 decoder. [Thanks to sangjun and
ycdxsb for the bug reports.]
Tiling patterns that use non-Normal blend modes can't be cached.
Fixed a bitmap size sanity check in the JBIG2 decoder. [Thanks to Han
Zheng (NCNIPC of China, Hexhive), for the bug report.]
Fixed a missing bounds check in FoFiType1C::convertToOpenType (used in
pdftohtml). [Thanks to cyth for the bug report.]
Fixed a use-after-free bug in pdftohtml. [Thanks to FeRDNYC for the
bug report.]
Merged aconf2.h into aconf.h; corrected the cmake config settings for
paths; added the BASE14_FONT_DIR config option. [Thanks to FeRDNYC
for the suggestions.]
Fixed a missing check for a zero-length index in the CFF (Type1C) font
parser. [Thanks to Yuhang Huang (NCNIPC of China), Han Zheng
(NCNIPC of China, Hexhive), Wanying Cao, Jiayu Zhao (NCNIPC of
China) for the bug report.]
Add an object loop check to Catalog::countPageTree().
The DCT decoder wasn't checking for an SOF before the first SOS.
[Thanks to cyth for the bug report.]
The inline image decoder was skipping to end-of-stream in the wrong
stream object. [Thanks to cyth for the bug report.]
Fixed a bug in the JPEG 2000 decoder when nLayers > 1 and the
'termination on each coding pass' flag is set.
Removed the #pragma interface/implementation stuff (which is outdated
and useless at this point).
Fixed a bug in the ICCBased color space parser that was allowing the
number of components to be zero. (CVE-2023-2662) [Thanks to
huckleberry for the bug report.]
Added checks for PDF object loops in AcroForm::scanField()
(CVE-2018-7453, CVE-2018-16369, CVE-2022-36561, CVE-2022-41844),
Catalog::readPageLabelTree2() (CVE-2023-2663), and
Catalog::readEmbeddedFileTree() (CVE-2023-2664).
The zero-width character problem can also happen if the page size is
very large -- that needs to be limited too, the same way as
character position coordinates. (CVE-2023-3044) [Thanks to jlinliu
for the bug report.]
Add some missing bounds check code in DCTStream. [Thanks to Jiahao
Liu for the bug report.]
Fix a deadlock when an object stream's length field is contained in
another object stream. (CVE-2023-3436) [Thanks to Jiahao Liu for
the bug report.]
Correctly handle tiling patterns with negative step values.
Ignore overprint in soft masks (to match Adobe's behavior).
```
2024-02-11 19:59:03 +03:00
|
|
|
urls = [
|
|
|
|
"https://dl.xpdfreader.com/xpdf-${version}.tar.gz"
|
|
|
|
"https://dl.xpdfreader.com/old/xpdf-${version}.tar.gz"
|
|
|
|
];
|
|
|
|
hash = "sha256-LBxKSrXTdoulZDjPiyYMaJr63jFHHI+VCgVJx310i/w=";
|
2005-11-28 00:06:08 +03:00
|
|
|
};
|
2010-10-07 17:14:29 +04:00
|
|
|
|
2018-03-01 18:32:31 +03:00
|
|
|
# Fix "No known features for CXX compiler", see
|
|
|
|
# https://cmake.org/pipermail/cmake/2016-December/064733.html and the note at
|
|
|
|
# https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html
|
2023-04-21 22:41:25 +03:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace CMakeLists.txt --replace \
|
|
|
|
'cmake_minimum_required(VERSION 2.8.12)' 'cmake_minimum_required(VERSION 3.1.0)'
|
|
|
|
'';
|
2018-03-01 18:32:31 +03:00
|
|
|
|
2019-07-05 18:42:08 +03:00
|
|
|
nativeBuildInputs =
|
|
|
|
[ cmake ]
|
2021-01-15 08:42:41 +03:00
|
|
|
++ lib.optional enableGUI wrapQtAppsHook;
|
2017-08-29 00:08:01 +03:00
|
|
|
|
2019-09-12 23:40:16 +03:00
|
|
|
cmakeFlags = ["-DSYSTEM_XPDFRC=/etc/xpdfrc" "-DA4_PAPER=ON" "-DOPI_SUPPORT=ON"]
|
2021-01-15 08:42:41 +03:00
|
|
|
++ lib.optional (!enablePrinting) "-DXPDFWIDGET_PRINTING=OFF";
|
2017-08-29 00:08:01 +03:00
|
|
|
|
2014-12-09 16:35:54 +03:00
|
|
|
buildInputs = [ zlib libpng ] ++
|
2021-01-15 08:42:41 +03:00
|
|
|
lib.optional enableGUI qtbase ++
|
|
|
|
lib.optional enablePrinting cups ++
|
|
|
|
lib.optional enablePDFtoPPM freetype;
|
2007-10-03 16:16:48 +04:00
|
|
|
|
2019-09-12 23:40:16 +03:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "xpdf";
|
|
|
|
desktopName = "Xpdf";
|
|
|
|
comment = "Views Adobe PDF files";
|
|
|
|
icon = "xpdf";
|
|
|
|
exec = "xpdf %f";
|
2022-02-22 17:56:15 +03:00
|
|
|
categories = [ "Office" ];
|
2019-09-12 23:40:16 +03:00
|
|
|
};
|
|
|
|
|
2021-02-09 13:46:10 +03:00
|
|
|
postInstall = lib.optionalString (!stdenv.isDarwin) ''
|
|
|
|
install -Dm644 ${desktopItem}/share/applications/xpdf.desktop -t $out/share/applications
|
2019-09-12 23:40:16 +03:00
|
|
|
install -Dm644 $src/xpdf-qt/xpdf-icon.svg $out/share/pixmaps/xpdf.svg
|
|
|
|
'';
|
|
|
|
|
2021-01-11 10:54:33 +03:00
|
|
|
meta = with lib; {
|
2019-09-12 23:40:16 +03:00
|
|
|
homepage = "https://www.xpdfreader.com";
|
2016-06-20 13:53:46 +03:00
|
|
|
description = "Viewer for Portable Document Format (PDF) files";
|
2019-03-02 14:45:18 +03:00
|
|
|
longDescription = ''
|
|
|
|
XPDF includes multiple tools for viewing and processing PDF files.
|
|
|
|
xpdf: PDF viewer (with Graphical Interface)
|
|
|
|
pdftotext: converts PDF to text
|
|
|
|
pdftops: converts PDF to PostScript
|
|
|
|
pdftoppm: converts PDF pages to netpbm (PPM/PGM/PBM) image files
|
|
|
|
pdftopng: converts PDF pages to PNG image files
|
|
|
|
pdftohtml: converts PDF to HTML
|
|
|
|
pdfinfo: extracts PDF metadata
|
|
|
|
pdfimages: extracts raw images from PDF files
|
|
|
|
pdffonts: lists fonts used in PDF files
|
|
|
|
pdfdetach: extracts attached files from PDF files
|
|
|
|
'';
|
2021-02-09 13:46:10 +03:00
|
|
|
license = with licenses; [ gpl2Only gpl3Only ];
|
2018-09-01 15:34:00 +03:00
|
|
|
platforms = platforms.unix;
|
2019-09-12 23:40:16 +03:00
|
|
|
maintainers = with maintainers; [ sikmir ];
|
2019-11-12 21:44:35 +03:00
|
|
|
knownVulnerabilities = [
|
|
|
|
"CVE-2019-9587: loop in PDF objects"
|
|
|
|
"CVE-2019-9588: loop in PDF objects"
|
|
|
|
"CVE-2019-16088: loop in PDF objects"
|
2023-05-19 17:36:39 +03:00
|
|
|
"CVE-2022-38334"
|
|
|
|
"CVE-2022-38928"
|
|
|
|
"CVE-2022-41842"
|
|
|
|
"CVE-2022-41843"
|
|
|
|
"CVE-2022-43071"
|
|
|
|
"CVE-2022-43295"
|
|
|
|
"CVE-2022-45586"
|
|
|
|
"CVE-2022-45587"
|
|
|
|
"CVE-2023-26930"
|
|
|
|
"CVE-2023-26931"
|
|
|
|
"CVE-2023-26934"
|
|
|
|
"CVE-2023-26935"
|
|
|
|
"CVE-2023-26936"
|
|
|
|
"CVE-2023-26937"
|
|
|
|
"CVE-2023-26938"
|
|
|
|
"CVE-2023-27655"
|
|
|
|
"CVE-2023-31557"
|
2019-11-12 21:44:35 +03:00
|
|
|
];
|
2010-10-07 17:14:13 +04:00
|
|
|
};
|
2005-11-28 00:06:08 +03:00
|
|
|
}
|