Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,209 @@
|
||||
From 93e60d3df358c0ae6f3dba79e1c9684657683d89 Mon Sep 17 00:00:00 2001
|
||||
From: Till Kamppeter <till.kamppeter@gmail.com>
|
||||
Date: Wed, 17 May 2023 11:11:29 +0200
|
||||
Subject: [PATCH] beh backend: Use execv() instead of system() - CVE-2023-24805
|
||||
|
||||
With execv() command line arguments are passed as separate strings and
|
||||
not the full command line in a single string. This prevents arbitrary
|
||||
command execution by escaping the quoting of the arguments in a job
|
||||
with a forged job title.
|
||||
|
||||
In addition, done the following fixes and improvements:
|
||||
|
||||
- Do not allow '/' in the scheme of the URI (= backend executable
|
||||
name), to assure that only backends inside /usr/lib/cups/backend/
|
||||
are used.
|
||||
|
||||
- URI must have ':', to split off scheme, otherwise error out.
|
||||
|
||||
- Check return value of snprintf() to create call path for backend, to
|
||||
error out on truncation of a too long scheme or on complete failure
|
||||
due to a completely odd scheme.
|
||||
|
||||
- Use strncat() instead of strncpy() for getting scheme from URI, the latter
|
||||
does not require setting terminating zero byte in case of truncation.
|
||||
|
||||
- Also exclude "." or ".." as scheme, as directories are not valid CUPS
|
||||
backends.
|
||||
|
||||
- Do not use fprintf() in sigterm_handler(), to not interfere with a
|
||||
fprintf() which could be running in the main process when
|
||||
sigterm_handler() is triggered.
|
||||
|
||||
- Use "static volatile int" for global variable job_canceled.
|
||||
|
||||
CVE: CVE-2023-24805
|
||||
Upstream: https://github.com/OpenPrinting/cups-filters/commit/93e60d3df358c0ae6f3dba79e1c9684657683d89
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
backend/beh.c | 107 +++++++++++++++++++++++++++++++++++++++-----------
|
||||
1 file changed, 84 insertions(+), 23 deletions(-)
|
||||
|
||||
diff --git a/backend/beh.c b/backend/beh.c
|
||||
index 225fd27d5..8d51235b1 100644
|
||||
--- a/backend/beh.c
|
||||
+++ b/backend/beh.c
|
||||
@@ -22,12 +22,13 @@
|
||||
#include "backend-private.h"
|
||||
#include <cups/array.h>
|
||||
#include <ctype.h>
|
||||
+#include <sys/wait.h>
|
||||
|
||||
/*
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
-static int job_canceled = 0; /* Set to 1 on SIGTERM */
|
||||
+static volatile int job_canceled = 0; /* Set to 1 on SIGTERM */
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
@@ -213,21 +214,40 @@ call_backend(char *uri, /* I - URI of final destination */
|
||||
char **argv, /* I - Command-line arguments */
|
||||
char *filename) { /* I - File name of input data */
|
||||
const char *cups_serverbin; /* Location of programs */
|
||||
+ char *backend_argv[8]; /* Arguments for backend */
|
||||
char scheme[1024], /* Scheme from URI */
|
||||
*ptr, /* Pointer into scheme */
|
||||
- cmdline[65536]; /* Backend command line */
|
||||
- int retval;
|
||||
+ backend_path[2048]; /* Backend path */
|
||||
+ int pid = 0, /* Process ID of backend */
|
||||
+ wait_pid, /* Process ID from wait() */
|
||||
+ wait_status, /* Status from child */
|
||||
+ retval = 0;
|
||||
+ int bytes;
|
||||
|
||||
/*
|
||||
* Build the backend command line...
|
||||
*/
|
||||
|
||||
- strncpy(scheme, uri, sizeof(scheme) - 1);
|
||||
- if (strlen(uri) > 1023)
|
||||
- scheme[1023] = '\0';
|
||||
+ scheme[0] = '\0';
|
||||
+ strncat(scheme, uri, sizeof(scheme) - 1);
|
||||
if ((ptr = strchr(scheme, ':')) != NULL)
|
||||
*ptr = '\0';
|
||||
-
|
||||
+ else {
|
||||
+ fprintf(stderr,
|
||||
+ "ERROR: beh: Invalid URI, no colon (':') to mark end of scheme part.\n");
|
||||
+ exit (CUPS_BACKEND_FAILED);
|
||||
+ }
|
||||
+ if (strchr(scheme, '/')) {
|
||||
+ fprintf(stderr,
|
||||
+ "ERROR: beh: Invalid URI, scheme contains a slash ('/').\n");
|
||||
+ exit (CUPS_BACKEND_FAILED);
|
||||
+ }
|
||||
+ if (!strcmp(scheme, ".") || !strcmp(scheme, "..")) {
|
||||
+ fprintf(stderr,
|
||||
+ "ERROR: beh: Invalid URI, scheme (\"%s\") is a directory.\n",
|
||||
+ scheme);
|
||||
+ exit (CUPS_BACKEND_FAILED);
|
||||
+ }
|
||||
if ((cups_serverbin = getenv("CUPS_SERVERBIN")) == NULL)
|
||||
cups_serverbin = CUPS_SERVERBIN;
|
||||
|
||||
@@ -235,16 +255,29 @@ call_backend(char *uri, /* I - URI of final destination */
|
||||
fprintf(stderr,
|
||||
"ERROR: beh: Direct output into a file not supported.\n");
|
||||
exit (CUPS_BACKEND_FAILED);
|
||||
- } else
|
||||
- snprintf(cmdline, sizeof(cmdline),
|
||||
- "%s/backend/%s '%s' '%s' '%s' '%s' '%s' %s",
|
||||
- cups_serverbin, scheme, argv[1], argv[2], argv[3],
|
||||
- /* Apply number of copies only if beh was called with a
|
||||
- file name and not with the print data in stdin, as
|
||||
- backends should handle copies only if they are called
|
||||
- with a file name */
|
||||
- (argc == 6 ? "1" : argv[4]),
|
||||
- argv[5], filename);
|
||||
+ }
|
||||
+
|
||||
+ backend_argv[0] = uri;
|
||||
+ backend_argv[1] = argv[1];
|
||||
+ backend_argv[2] = argv[2];
|
||||
+ backend_argv[3] = argv[3];
|
||||
+ /* Apply number of copies only if beh was called with a file name
|
||||
+ and not with the print data in stdin, as backends should handle
|
||||
+ copies only if they are called with a file name */
|
||||
+ backend_argv[4] = (argc == 6 ? "1" : argv[4]);
|
||||
+ backend_argv[5] = argv[5];
|
||||
+ backend_argv[6] = filename;
|
||||
+ backend_argv[7] = NULL;
|
||||
+
|
||||
+ bytes = snprintf(backend_path, sizeof(backend_path),
|
||||
+ "%s/backend/%s", cups_serverbin, scheme);
|
||||
+ if (bytes < 0 || bytes >= sizeof(backend_path))
|
||||
+ {
|
||||
+ fprintf(stderr,
|
||||
+ "ERROR: beh: Invalid scheme (\"%s\"), could not determing backend path.\n",
|
||||
+ scheme);
|
||||
+ return (CUPS_BACKEND_FAILED);
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Overwrite the device URI and run the actual backend...
|
||||
@@ -253,18 +286,44 @@ call_backend(char *uri, /* I - URI of final destination */
|
||||
setenv("DEVICE_URI", uri, 1);
|
||||
|
||||
fprintf(stderr,
|
||||
- "DEBUG: beh: Executing backend command line \"%s\"...\n",
|
||||
- cmdline);
|
||||
+ "DEBUG: beh: Executing backend command line \"%s '%s' '%s' '%s' '%s' '%s' %s\"...\n",
|
||||
+ backend_path, backend_argv[1], backend_argv[2], backend_argv[3],
|
||||
+ backend_argv[4], backend_argv[5], backend_argv[6]);
|
||||
fprintf(stderr,
|
||||
"DEBUG: beh: Using device URI: %s\n",
|
||||
uri);
|
||||
|
||||
- retval = system(cmdline) >> 8;
|
||||
+ if ((pid = fork()) == 0) {
|
||||
+ /*
|
||||
+ * Child comes here...
|
||||
+ */
|
||||
+
|
||||
+ /* Run the backend */
|
||||
+ execv(backend_path, backend_argv);
|
||||
|
||||
- if (retval == -1)
|
||||
fprintf(stderr, "ERROR: Unable to execute backend command line: %s\n",
|
||||
strerror(errno));
|
||||
|
||||
+ exit(1);
|
||||
+ } else if (pid < 0) {
|
||||
+ /*
|
||||
+ * Unable to fork!
|
||||
+ */
|
||||
+
|
||||
+ return (CUPS_BACKEND_FAILED);
|
||||
+ }
|
||||
+
|
||||
+ while ((wait_pid = wait(&wait_status)) < 0 && errno == EINTR);
|
||||
+
|
||||
+ if (wait_pid >= 0 && wait_status) {
|
||||
+ if (WIFEXITED(wait_status))
|
||||
+ retval = WEXITSTATUS(wait_status);
|
||||
+ else if (WTERMSIG(wait_status) != SIGTERM)
|
||||
+ retval = WTERMSIG(wait_status);
|
||||
+ else
|
||||
+ retval = 0;
|
||||
+ }
|
||||
+
|
||||
return (retval);
|
||||
}
|
||||
|
||||
@@ -277,8 +336,10 @@ static void
|
||||
sigterm_handler(int sig) { /* I - Signal number (unused) */
|
||||
(void)sig;
|
||||
|
||||
- fprintf(stderr,
|
||||
- "DEBUG: beh: Job canceled.\n");
|
||||
+ const char * const msg = "DEBUG: beh: Job canceled.\n";
|
||||
+ /* The if() is to eliminate the return value and silence the warning
|
||||
+ about an unused return value. */
|
||||
+ if (write(2, msg, strlen(msg)));
|
||||
|
||||
if (job_canceled)
|
||||
_exit(CUPS_BACKEND_OK);
|
||||
@@ -0,0 +1,84 @@
|
||||
From b03866fd2e251a6d822a5e8c807c8d47b4d2dce2 Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Dohnal <zdohnal@redhat.com>
|
||||
Date: Wed, 12 Nov 2025 16:02:20 +0100
|
||||
Subject: [PATCH] rastertopclx.c: Fix infinite loop caused by crafted file
|
||||
|
||||
Infinite loop happened because of crafted input raster file, which led
|
||||
into heap buffer overflow of `CompressBuf` array.
|
||||
|
||||
Based on comments there should be always some `count` when compressing
|
||||
the data, and processing of crafted file ended with offset and count
|
||||
being 0.
|
||||
|
||||
Fixes CVE-2025-64524
|
||||
|
||||
Upstream: https://github.com/OpenPrinting/cups-filters/commit/b03866fd2e251a6d822a5e8c807c8d47b4d2dce2
|
||||
|
||||
CVE: CVE-2025-64524
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
filter/rastertopclx.c | 25 +++++++++++++++++++++++--
|
||||
1 file changed, 23 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/filter/rastertopclx.c b/filter/rastertopclx.c
|
||||
index 3e7c129da..1015308da 100644
|
||||
--- a/filter/rastertopclx.c
|
||||
+++ b/filter/rastertopclx.c
|
||||
@@ -818,10 +818,10 @@ StartPage(ppd_file_t *ppd, /* I - PPD file */
|
||||
}
|
||||
|
||||
if (header->cupsCompression)
|
||||
- CompBuffer = malloc(DotBufferSize * 4);
|
||||
+ CompBuffer = calloc(DotBufferSize * 4, sizeof(unsigned char));
|
||||
|
||||
if (header->cupsCompression >= 3)
|
||||
- SeedBuffer = malloc(DotBufferSize);
|
||||
+ SeedBuffer = calloc(DotBufferSize, sizeof(unsigned char));
|
||||
|
||||
SeedInvalid = 1;
|
||||
|
||||
@@ -1152,6 +1152,13 @@ CompressData(unsigned char *line, /* I - Data to compress */
|
||||
seed ++;
|
||||
count ++;
|
||||
}
|
||||
+
|
||||
+ //
|
||||
+ // Bail out if we don't have count to compress
|
||||
+ //
|
||||
+
|
||||
+ if (count == 0)
|
||||
+ break;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1245,6 +1252,13 @@ CompressData(unsigned char *line, /* I - Data to compress */
|
||||
|
||||
count = line_ptr - start;
|
||||
|
||||
+ //
|
||||
+ // Bail out if we don't have count to compress
|
||||
+ //
|
||||
+
|
||||
+ if (count == 0)
|
||||
+ break;
|
||||
+
|
||||
#if 0
|
||||
fprintf(stderr, "DEBUG: offset=%d, count=%d, comp_ptr=%p(%d of %d)...\n",
|
||||
offset, count, comp_ptr, comp_ptr - CompBuffer,
|
||||
@@ -1416,6 +1430,13 @@ CompressData(unsigned char *line, /* I - Data to compress */
|
||||
|
||||
count = (line_ptr - start) / 3;
|
||||
|
||||
+ //
|
||||
+ // Bail out if we don't have count to compress
|
||||
+ //
|
||||
+
|
||||
+ if (count == 0)
|
||||
+ break;
|
||||
+
|
||||
/*
|
||||
* Place mode 10 compression data in the buffer; each sequence
|
||||
* starts with a command byte that looks like:
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
From 0cce0968980e8fdd9053cba436a66246b2303a84 Mon Sep 17 00:00:00 2001
|
||||
From: Till Kamppeter <till.kamppeter@gmail.com>
|
||||
Date: Wed, 6 Dec 2023 22:56:41 +0100
|
||||
Subject: [PATCH] libcupsfilters: Fixed building with QPDF 11.x
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Set CXXFLAGS="-DPOINTERHOLDER_TRANSITION=0" to silence QPDF warnings
|
||||
|
||||
QPDF 11 issues warnings about deprecated "PointerHolder", even if the
|
||||
code does not use "PointerHolder" any more. This compiler macro
|
||||
suppresses the warnings.
|
||||
|
||||
See /usr/include/qpdf/PointerHolder.hh of QPDF 11.
|
||||
|
||||
Backported from libcupsfilters (2.x), commit 076a994fce
|
||||
|
||||
Added "-std=c++17" C++ compiler flag (PR#18)
|
||||
|
||||
Needed as otherwise the QPDF.hh file of QPDF 11 causes the error
|
||||
|
||||
‘std::string_view’ has not been declared
|
||||
|
||||
Adding the "-std=c++17" to CXXFLAGS fixes this. See also
|
||||
|
||||
https://stackoverflow.com/questions/58295334/error-stdstring-view-has-no
|
||||
t-been-declared
|
||||
|
||||
Backported from libcupsfilters (2.x), commit e1daf27c59
|
||||
|
||||
Upstream: https://github.com/OpenPrinting/cups-filters/commit/0cce0968980e8fdd9053cba436a66246b2303a84
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
configure.ac | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 083aecb83..f293e803b 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -837,7 +837,10 @@ AS_IF([test x"$GCC" = "xyes"], [
|
||||
CXXFLAGS="$CXXFLAGS -Wall " # -Weffc++" # TODO: enable when it does not print 1MB of warnings
|
||||
])
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE"
|
||||
-CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE"
|
||||
+CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE -DPOINTERHOLDER_TRANSITION=0"
|
||||
+# ^^ Silence deprecation warnings of QPDF 11
|
||||
+# See /usr/include/qpdf/PointerHolder.hh
|
||||
+CXXFLAGS="$CXXFLAGS -std=c++17" # Needed to build with current QPDF (11.x)
|
||||
|
||||
# ==========================
|
||||
# Braille embossing/liblouis
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
From 7b6e46ea6237763104bf2a22eca66ba92a6b71a4 Mon Sep 17 00:00:00 2001
|
||||
From: Till Kamppeter <till.kamppeter@gmail.com>
|
||||
Date: Wed, 12 Nov 2025 16:10:51 +0100
|
||||
Subject: [PATCH] Updated code to be built with QPDF 12.x
|
||||
|
||||
- Set `#define POINTERHOLDER_TRANSITION 3`
|
||||
- Explicitly `#include <qpdf/PointerHolder.hh>`
|
||||
- `ph = (PointerHolder<Buffer>) new Buffer(buff, profile_size);` in `rastertopdf.cpp`
|
||||
- Removed `-DPOINTERHOLDER_TRANSITION=0` from `CXXFLAGS` in `configure.ac`
|
||||
- Replaced all `replaceOrRemoveKey()` by `replaceKey()`
|
||||
|
||||
Upstream: https://github.com/OpenPrinting/cups-filters/commit/7b6e46ea6237763104bf2a22eca66ba92a6b71a4
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
configure.ac | 3 ---
|
||||
filter/pdf.cxx | 2 ++
|
||||
filter/pdftopdf/qpdf_pdftopdf_processor.cc | 18 +++++++++---------
|
||||
filter/pdftopdf/qpdf_xobject.cc | 2 ++
|
||||
filter/rastertopdf.cpp | 4 +++-
|
||||
filter/urftopdf.cpp | 2 ++
|
||||
6 files changed, 18 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 32180d0da..702b58a0a 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -793,9 +793,6 @@ AS_IF([test x"$GCC" = "xyes"], [
|
||||
CXXFLAGS="$CXXFLAGS -Wall " # -Weffc++" # TODO: enable when it does not print 1MB of warnings
|
||||
])
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE"
|
||||
-CXXFLAGS="$CXXFLAGS -D_GNU_SOURCE -DPOINTERHOLDER_TRANSITION=0"
|
||||
-# ^^ Silence deprecation warnings of QPDF 11
|
||||
-# See /usr/include/qpdf/PointerHolder.hh
|
||||
CXXFLAGS="$CXXFLAGS -std=c++17" # Needed to build with current QPDF (11.x)
|
||||
|
||||
# ==========================
|
||||
diff --git a/filter/pdf.cxx b/filter/pdf.cxx
|
||||
index 68b1af912..7d592dc95 100644
|
||||
--- a/filter/pdf.cxx
|
||||
+++ b/filter/pdf.cxx
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
+#define POINTERHOLDER_TRANSITION 3
|
||||
+#include <qpdf/PointerHolder.hh>
|
||||
#include <qpdf/QPDF.hh>
|
||||
#include <qpdf/QPDFObjectHandle.hh>
|
||||
#include <qpdf/QPDFWriter.hh>
|
||||
diff --git a/filter/pdftopdf/qpdf_pdftopdf_processor.cc b/filter/pdftopdf/qpdf_pdftopdf_processor.cc
|
||||
index beffc2423..3c21a6512 100644
|
||||
--- a/filter/pdftopdf/qpdf_pdftopdf_processor.cc
|
||||
+++ b/filter/pdftopdf/qpdf_pdftopdf_processor.cc
|
||||
@@ -83,10 +83,10 @@ QPDFObjectHandle QPDF_PDFTOPDF_PageHandle::get() // {{{
|
||||
page.getKey("/Resources").replaceKey("/XObject",QPDFObjectHandle::newDictionary(xobjs));
|
||||
content.append("Q\n");
|
||||
page.getKey("/Contents").replaceStreamData(content,QPDFObjectHandle::newNull(),QPDFObjectHandle::newNull());
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(rotation));
|
||||
+ page.replaceKey("/Rotate",makeRotate(rotation));
|
||||
} else {
|
||||
Rotation rot=getRotate(page)+rotation;
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(rot));
|
||||
+ page.replaceKey("/Rotate",makeRotate(rot));
|
||||
}
|
||||
page=QPDFObjectHandle(); // i.e. uninitialized
|
||||
return ret;
|
||||
@@ -181,9 +181,9 @@ Rotation QPDF_PDFTOPDF_PageHandle::crop(const PageRect &cropRect,Rotation orient
|
||||
page.assertInitialized();
|
||||
Rotation save_rotate = getRotate(page);
|
||||
if(orientation==ROT_0||orientation==ROT_180)
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_90));
|
||||
+ page.replaceKey("/Rotate",makeRotate(ROT_90));
|
||||
else
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_0));
|
||||
+ page.replaceKey("/Rotate",makeRotate(ROT_0));
|
||||
|
||||
PageRect currpage= getBoxAsRect(getTrimBox(page));
|
||||
double width = currpage.right-currpage.left;
|
||||
@@ -242,7 +242,7 @@ Rotation QPDF_PDFTOPDF_PageHandle::crop(const PageRect &cropRect,Rotation orient
|
||||
//Cropping.
|
||||
// TODO: Borders are covered by the image. buffer space?
|
||||
page.replaceKey("/TrimBox",makeBox(currpage.left,currpage.bottom,currpage.right,currpage.top));
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(save_rotate));
|
||||
+ page.replaceKey("/Rotate",makeRotate(save_rotate));
|
||||
return getRotate(page);
|
||||
}
|
||||
|
||||
@@ -251,14 +251,14 @@ bool QPDF_PDFTOPDF_PageHandle::is_landscape(Rotation orientation)
|
||||
page.assertInitialized();
|
||||
Rotation save_rotate = getRotate(page);
|
||||
if(orientation==ROT_0||orientation==ROT_180)
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_90));
|
||||
+ page.replaceKey("/Rotate",makeRotate(ROT_90));
|
||||
else
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(ROT_0));
|
||||
+ page.replaceKey("/Rotate",makeRotate(ROT_0));
|
||||
|
||||
PageRect currpage= getBoxAsRect(getTrimBox(page));
|
||||
double width = currpage.right-currpage.left;
|
||||
double height = currpage.top-currpage.bottom;
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(save_rotate));
|
||||
+ page.replaceKey("/Rotate",makeRotate(save_rotate));
|
||||
if(width>height)
|
||||
return true;
|
||||
return false;
|
||||
@@ -665,7 +665,7 @@ void QPDF_PDFTOPDF_Processor::autoRotateAll(bool dst_lscape,Rotation normal_land
|
||||
// TODO? other rotation direction, e.g. if (src_rot==ROT_0)&&(param.orientation==ROT_270) ... etc.
|
||||
// rotation=ROT_270;
|
||||
|
||||
- page.replaceOrRemoveKey("/Rotate",makeRotate(src_rot+rotation));
|
||||
+ page.replaceKey("/Rotate",makeRotate(src_rot+rotation));
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/filter/pdftopdf/qpdf_xobject.cc b/filter/pdftopdf/qpdf_xobject.cc
|
||||
index 12732f1e9..2550bdd4f 100644
|
||||
--- a/filter/pdftopdf/qpdf_xobject.cc
|
||||
+++ b/filter/pdftopdf/qpdf_xobject.cc
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "qpdf_xobject.h"
|
||||
//#include <qpdf/Types.h>
|
||||
+#define POINTERHOLDER_TRANSITION 3
|
||||
+#include <qpdf/PointerHolder.hh>
|
||||
#include <qpdf/QPDF.hh>
|
||||
#include <qpdf/Pl_Discard.hh>
|
||||
#include <qpdf/Pl_Count.hh>
|
||||
diff --git a/filter/rastertopdf.cpp b/filter/rastertopdf.cpp
|
||||
index ad5dd34c5..6a1aa218f 100644
|
||||
--- a/filter/rastertopdf.cpp
|
||||
+++ b/filter/rastertopdf.cpp
|
||||
@@ -39,6 +39,8 @@
|
||||
#include <arpa/inet.h> // ntohl
|
||||
|
||||
#include <vector>
|
||||
+#define POINTERHOLDER_TRANSITION 3
|
||||
+#include <qpdf/PointerHolder.hh>
|
||||
#include <qpdf/QPDF.hh>
|
||||
#include <qpdf/QPDFWriter.hh>
|
||||
#include <qpdf/QUtil.hh>
|
||||
@@ -481,7 +483,7 @@ QPDFObjectHandle embedIccProfile(QPDF &pdf)
|
||||
cmsSaveProfileToMem(colorProfile, buff, &profile_size);
|
||||
|
||||
// Write ICC profile buffer into PDF
|
||||
- ph = new Buffer(buff, profile_size);
|
||||
+ ph = (PointerHolder<Buffer>) new Buffer(buff, profile_size);
|
||||
iccstream = QPDFObjectHandle::newStream(&pdf, ph);
|
||||
iccstream.replaceDict(QPDFObjectHandle::newDictionary(streamdict));
|
||||
|
||||
diff --git a/filter/urftopdf.cpp b/filter/urftopdf.cpp
|
||||
index 4e7f6535a..e5c9f1f33 100644
|
||||
--- a/filter/urftopdf.cpp
|
||||
+++ b/filter/urftopdf.cpp
|
||||
@@ -32,6 +32,8 @@
|
||||
#include <arpa/inet.h> // ntohl
|
||||
|
||||
#include <vector>
|
||||
+#define POINTERHOLDER_TRANSITION 3
|
||||
+#include <qpdf/PointerHolder.hh>
|
||||
#include <qpdf/QPDF.hh>
|
||||
#include <qpdf/QPDFWriter.hh>
|
||||
#include <qpdf/QUtil.hh>
|
||||
--
|
||||
2.47.3
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 50d94ca0f2fa6177613c97c59791bde568631865 Mon Sep 17 00:00:00 2001
|
||||
From: Till Kamppeter <till.kamppeter@gmail.com>
|
||||
Date: Mon, 10 Nov 2025 18:31:48 +0100
|
||||
Subject: [PATCH] Fix out-of-bounds write in pdftoraster
|
||||
|
||||
PDFs with too large page dimensions could cause an integer overflow and then a too small buffer for the pixel line to be allocated.
|
||||
|
||||
Fixed this by cropping the page size to the maximum allowed by the standard, 14400x14400pt, 200x200in, 5x5m
|
||||
|
||||
https://community.adobe.com/t5/indesign-discussions/maximum-width-of-a-pdf/td-p/9217372
|
||||
|
||||
CVE: CVE-2025-64503
|
||||
Upstream: https://github.com/OpenPrinting/cups-filters/commit/50d94ca0f2fa6177613c97c59791bde568631865
|
||||
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
|
||||
---
|
||||
filter/pdftoraster.cxx | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/filter/pdftoraster.cxx b/filter/pdftoraster.cxx
|
||||
index 7b3af924f..b64b34c62 100755
|
||||
--- a/filter/pdftoraster.cxx
|
||||
+++ b/filter/pdftoraster.cxx
|
||||
@@ -1698,6 +1698,18 @@ static void outPage(poppler::document *doc, int pageNo,
|
||||
header.PageSize[0] = (unsigned)l;
|
||||
else
|
||||
header.PageSize[1] = (unsigned)l;
|
||||
+ /*
|
||||
+ Maximum allowed page size for PDF is 200x200 inches (~ 5x5 m), or 14400x14400 pt
|
||||
+ https://community.adobe.com/t5/indesign-discussions/maximum-width-of-a-pdf/td-p/9217372
|
||||
+ */
|
||||
+ if (header.PageSize[0] > 14400) {
|
||||
+ fprintf(stderr, "ERROR: Page width is %dpt, too large, cropping to 14400pt\n", header.PageSize[0]);
|
||||
+ header.PageSize[0] = 14400;
|
||||
+ }
|
||||
+ if (header.PageSize[1] > 14400) {
|
||||
+ fprintf(stderr, "ERROR: Page height is %dpt, too large, cropping to 14400pt\n", header.PageSize[1]);
|
||||
+ header.PageSize[1] = 14400;
|
||||
+ }
|
||||
|
||||
memset(paperdimensions, 0, sizeof(paperdimensions));
|
||||
memset(margins, 0, sizeof(margins));
|
||||
40
package/cups-filters/Config.in
Normal file
40
package/cups-filters/Config.in
Normal file
@@ -0,0 +1,40 @@
|
||||
config BR2_PACKAGE_CUPS_FILTERS
|
||||
bool "cups-filters"
|
||||
# needs fork()
|
||||
depends on BR2_USE_MMU
|
||||
depends on BR2_INSTALL_LIBSTDCPP # qpdf
|
||||
depends on !BR2_STATIC_LIBS
|
||||
depends on BR2_USE_WCHAR # libglib2
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS # libglib2
|
||||
depends on BR2_PACKAGE_CUPS
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_10 # qpdf
|
||||
depends on BR2_TOOLCHAIN_HAS_ATOMIC # qpdf
|
||||
select BR2_PACKAGE_JPEG
|
||||
select BR2_PACKAGE_FONTCONFIG
|
||||
select BR2_PACKAGE_FREETYPE
|
||||
select BR2_PACKAGE_LCMS2
|
||||
select BR2_PACKAGE_LIBGLIB2
|
||||
select BR2_PACKAGE_QPDF
|
||||
help
|
||||
This project provides backends, filters, and other software
|
||||
that was once part of the core CUPS distribution but is no
|
||||
longer maintained by Apple Inc. In addition it contains
|
||||
additional filters and software developed independently of
|
||||
Apple, especially filters for the PDF-centric printing
|
||||
workflow introduced by OpenPrinting and a daemon to browse
|
||||
Bonjour broadcasts of remote CUPS printers to make these
|
||||
printers available locally and to provide backward
|
||||
compatibility to the old CUPS broadcasting and browsing of
|
||||
CUPS 1.5.x and older. From CUPS 1.6.0 on, this package is
|
||||
required for using printer drivers with CUPS under Linux.
|
||||
With CUPS 1.5.x and earlier this package can be used
|
||||
optionally to switch over to PDF-based printing.
|
||||
|
||||
http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters
|
||||
|
||||
comment "cups-filters needs a toolchain w/ wchar, C++, threads and dynamic library, gcc >= 10"
|
||||
depends on BR2_USE_MMU
|
||||
depends on BR2_TOOLCHAIN_HAS_ATOMIC
|
||||
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS || \
|
||||
!BR2_USE_WCHAR || BR2_STATIC_LIBS || \
|
||||
!BR2_TOOLCHAIN_GCC_AT_LEAST_10
|
||||
48
package/cups-filters/S82cups-browsed
Normal file
48
package/cups-filters/S82cups-browsed
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON="cups-browsed"
|
||||
PIDFILE="/var/run/$DAEMON.pid"
|
||||
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need the word splitting
|
||||
start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
|
||||
-- -c /etc/cups/cups-browsed.conf
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf 'Stopping %s: ' "$DAEMON"
|
||||
start-stop-daemon -K -q -p "$PIDFILE"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
rm -f "$PIDFILE"
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|stop|restart)
|
||||
"$1";;
|
||||
reload)
|
||||
# Restart, since there is no true "reload" feature.
|
||||
restart;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}"
|
||||
exit 1
|
||||
esac
|
||||
3
package/cups-filters/cups-filters.hash
Normal file
3
package/cups-filters/cups-filters.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# Locally computed:
|
||||
sha256 01a2acbd6bb78f09638047e4e9ce305d7e5ef4cb9ed6949672b5d901b7321dd4 cups-filters-1.28.17.tar.gz
|
||||
sha256 38192ffdaca98b718f78b2d4abc38bb087f0bbcc9a16d212c98b903b985f900f COPYING
|
||||
107
package/cups-filters/cups-filters.mk
Normal file
107
package/cups-filters/cups-filters.mk
Normal file
@@ -0,0 +1,107 @@
|
||||
################################################################################
|
||||
#
|
||||
# cups-filters
|
||||
#
|
||||
################################################################################
|
||||
|
||||
CUPS_FILTERS_VERSION = 1.28.17
|
||||
CUPS_FILTERS_SITE = https://github.com/OpenPrinting/cups-filters/releases/download/$(CUPS_FILTERS_VERSION)
|
||||
CUPS_FILTERS_LICENSE = GPL-2.0, GPL-2.0+, GPL-3.0, GPL-3.0+, LGPL-2, LGPL-2.1+, MIT, BSD-4-Clause
|
||||
CUPS_FILTERS_LICENSE_FILES = COPYING
|
||||
CUPS_FILTERS_CPE_ID_VENDOR = openprinting
|
||||
|
||||
# 0003-libcupsfilters-Fixed-building-with-QPDF-11.x.patch
|
||||
# 0004-Updated-code-to-be-built-with-QPDF-12.x.patch
|
||||
# ax_cxx_compile_stdcxx.m4 needs to be updated for gcc 16.x (C++20)
|
||||
CUPS_FILTERS_AUTORECONF = YES
|
||||
|
||||
# 0001-beh-backend-Use-execv-instead-of-system-CVE-2023-24805.patch
|
||||
CUPS_FILTERS_IGNORE_CVES += CVE-2023-24805
|
||||
|
||||
# 0002-rastertopclx.c-Fix-infinite-loop-caused-by-crafted-f.patch
|
||||
CUPS_FILTERS_IGNORE_CVES += CVE-2025-64524
|
||||
|
||||
# 0005-fix-out-of-bounds-write-in-pdftoraster.patch
|
||||
CUPS_FILTERS_IGNORE_CVES += CVE-2025-64503
|
||||
|
||||
CUPS_FILTERS_DEPENDENCIES = cups libglib2 lcms2 qpdf fontconfig freetype jpeg
|
||||
|
||||
CUPS_FILTERS_CONF_OPTS = \
|
||||
--disable-mutool \
|
||||
--disable-foomatic \
|
||||
--disable-braille \
|
||||
--enable-imagefilters \
|
||||
--with-cups-config=$(STAGING_DIR)/usr/bin/cups-config \
|
||||
--with-sysroot=$(STAGING_DIR) \
|
||||
--with-pdftops=pdftops \
|
||||
--with-jpeg \
|
||||
--with-test-font-path=/dev/null \
|
||||
--without-rcdir
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBPNG),y)
|
||||
CUPS_FILTERS_CONF_OPTS += --with-png
|
||||
CUPS_FILTERS_DEPENDENCIES += libpng
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --without-png
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_TIFF),y)
|
||||
CUPS_FILTERS_CONF_OPTS += --with-tiff
|
||||
CUPS_FILTERS_DEPENDENCIES += tiff
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --without-tiff
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_DBUS),y)
|
||||
CUPS_FILTERS_CONF_OPTS += --enable-dbus
|
||||
CUPS_FILTERS_DEPENDENCIES += dbus
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --disable-dbus
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_AVAHI_LIBAVAHI_CLIENT),y)
|
||||
CUPS_FILTERS_DEPENDENCIES += avahi
|
||||
CUPS_FILTERS_CONF_OPTS += --enable-avahi
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --disable-avahi
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_GHOSTSCRIPT),y)
|
||||
CUPS_FILTERS_DEPENDENCIES += ghostscript
|
||||
CUPS_FILTERS_CONF_OPTS += --enable-ghostscript
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --disable-ghostscript
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_IJS),y)
|
||||
CUPS_FILTERS_DEPENDENCIES += ijs
|
||||
CUPS_FILTERS_CONF_OPTS += --enable-ijs
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --disable-ijs
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_POPPLER),y)
|
||||
CUPS_FILTERS_DEPENDENCIES += poppler
|
||||
CUPS_FILTERS_CONF_OPTS += --enable-poppler
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --disable-poppler
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_LIBEXIF),y)
|
||||
CUPS_FILTERS_CONF_OPTS += --enable-exif
|
||||
CUPS_FILTERS_DEPENDENCIES += libexif
|
||||
else
|
||||
CUPS_FILTERS_CONF_OPTS += --disable-exif
|
||||
endif
|
||||
|
||||
define CUPS_FILTERS_INSTALL_INIT_SYSV
|
||||
$(INSTALL) -D -m 0755 package/cups-filters/S82cups-browsed \
|
||||
$(TARGET_DIR)/etc/init.d/S82cups-browsed
|
||||
endef
|
||||
|
||||
define CUPS_FILTERS_INSTALL_INIT_SYSTEMD
|
||||
$(INSTALL) -D -m 0755 $(@D)/utils/cups-browsed.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/cups-browsed.service
|
||||
endef
|
||||
|
||||
$(eval $(autotools-package))
|
||||
Reference in New Issue
Block a user