1.27.2
This commit is contained in:
parent
39704fa792
commit
890dbaf30a
1
.gitignore
vendored
1
.gitignore
vendored
@ -94,3 +94,4 @@
|
||||
/cups-filters-1.26.0.tar.xz
|
||||
/cups-filters-1.27.0.tar.xz
|
||||
/cups-filters-1.27.1.tar.xz
|
||||
/cups-filters-1.27.2.tar.xz
|
||||
|
121
0001-Fix-segfaults-in-test-suite-when-test-font-is-missin.patch
Normal file
121
0001-Fix-segfaults-in-test-suite-when-test-font-is-missin.patch
Normal file
@ -0,0 +1,121 @@
|
||||
From 1d66106e5ae45407b01459cb112ee09752166dba Mon Sep 17 00:00:00 2001
|
||||
From: Zdenek Dohnal <zdohnal@redhat.com>
|
||||
Date: Mon, 2 Mar 2020 14:56:55 +0100
|
||||
Subject: [PATCH] Fix segfaults in test suite when test font is missing
|
||||
|
||||
---
|
||||
configure.ac | 3 +++
|
||||
filter/test_pdf2.c | 8 +++++++-
|
||||
fontembed/test_analyze.c | 9 ++++++++-
|
||||
fontembed/test_pdf.c | 8 +++++++-
|
||||
fontembed/test_ps.c | 8 +++++++-
|
||||
5 files changed, 32 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d5fe836c..7ffb6693 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -788,6 +788,9 @@ AC_ARG_WITH([test-font-path],
|
||||
[with_test_font_path="$withval"],
|
||||
[with_test_font_path="/usr/share/fonts/dejavu/DejaVuSans.ttf"]
|
||||
)
|
||||
+AC_CHECK_FILE("$with_test_font_path", [], [
|
||||
+ AC_MSG_ERROR([Requested font file is missing. Please install a package providing it.])
|
||||
+])
|
||||
AC_DEFINE_UNQUOTED([TESTFONT], ["$with_test_font_path"], [Path to font used in tests])
|
||||
|
||||
# ================
|
||||
diff --git a/filter/test_pdf2.c b/filter/test_pdf2.c
|
||||
index a0c1d8b0..3d58a59d 100644
|
||||
--- a/filter/test_pdf2.c
|
||||
+++ b/filter/test_pdf2.c
|
||||
@@ -41,12 +41,18 @@ int main()
|
||||
|
||||
// font, pt.1
|
||||
const char *fn=TESTFONT;
|
||||
+ OTF_FILE *otf=NULL;
|
||||
/*
|
||||
if (argc==2) {
|
||||
fn=argv[1];
|
||||
}
|
||||
*/
|
||||
- OTF_FILE *otf=otf_load(fn);
|
||||
+ otf=otf_load(fn);
|
||||
+ if (!otf)
|
||||
+ {
|
||||
+ printf("Font %s was not loaded, exiting.\n", TESTFONT);
|
||||
+ return 1;
|
||||
+ }
|
||||
assert(otf);
|
||||
FONTFILE *ff=fontfile_open_sfnt(otf);
|
||||
EMB_PARAMS *emb=emb_new(ff,
|
||||
diff --git a/fontembed/test_analyze.c b/fontembed/test_analyze.c
|
||||
index 3f42573d..967a7516 100644
|
||||
--- a/fontembed/test_analyze.c
|
||||
+++ b/fontembed/test_analyze.c
|
||||
@@ -183,10 +183,17 @@ void show_hmtx(OTF_FILE *otf) // {{{
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *fn=TESTFONT;
|
||||
+ OTF_FILE *otf=NULL;
|
||||
if (argc==2) {
|
||||
fn=argv[1];
|
||||
}
|
||||
- OTF_FILE *otf=otf_load(fn);
|
||||
+ otf=otf_load(fn);
|
||||
+ if (!otf)
|
||||
+ {
|
||||
+ printf("Font %s was not loaded, exiting.\n", TESTFONT);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
assert(otf);
|
||||
if (otf->numTTC) {
|
||||
printf("TTC has %d fonts, using %d\n",otf->numTTC,otf->useTTC);
|
||||
diff --git a/fontembed/test_pdf.c b/fontembed/test_pdf.c
|
||||
index 565fd59f..881a4dca 100644
|
||||
--- a/fontembed/test_pdf.c
|
||||
+++ b/fontembed/test_pdf.c
|
||||
@@ -72,10 +72,16 @@ static inline void write_string(FILE *f,EMB_PARAMS *emb,const char *str) // {{{
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *fn=TESTFONT;
|
||||
+ OTF_FILE *otf=NULL;
|
||||
if (argc==2) {
|
||||
fn=argv[1];
|
||||
}
|
||||
- OTF_FILE *otf=otf_load(fn);
|
||||
+ otf=otf_load(fn);
|
||||
+ if (!otf)
|
||||
+ {
|
||||
+ printf("Font %s was not loaded, exiting.\n", TESTFONT);
|
||||
+ return 1;
|
||||
+ }
|
||||
assert(otf);
|
||||
FONTFILE *ff=fontfile_open_sfnt(otf);
|
||||
EMB_PARAMS *emb=emb_new(ff,
|
||||
diff --git a/fontembed/test_ps.c b/fontembed/test_ps.c
|
||||
index 1f8c2bb7..688d9392 100644
|
||||
--- a/fontembed/test_ps.c
|
||||
+++ b/fontembed/test_ps.c
|
||||
@@ -45,10 +45,16 @@ static inline void write_string(FILE *f,EMB_PARAMS *emb,const char *str) // {{{
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
const char *fn=TESTFONT;
|
||||
+ OTF_FILE *otf=NULL;
|
||||
if (argc==2) {
|
||||
fn=argv[1];
|
||||
}
|
||||
- OTF_FILE *otf=otf_load(fn);
|
||||
+ otf=otf_load(fn);
|
||||
+ if (!otf)
|
||||
+ {
|
||||
+ printf("Font %s was not loaded, exiting.\n", TESTFONT);
|
||||
+ return 1;
|
||||
+ }
|
||||
assert(otf);
|
||||
FONTFILE *ff=fontfile_open_sfnt(otf);
|
||||
EMB_PARAMS *emb=emb_new(ff,
|
||||
--
|
||||
2.21.1
|
||||
|
@ -1,66 +0,0 @@
|
||||
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
|
||||
index d83420a..0ae3400 100644
|
||||
--- a/utils/cups-browsed.c
|
||||
+++ b/utils/cups-browsed.c
|
||||
@@ -2491,18 +2491,35 @@ int check_printer_with_options(char* cluster_name, int idx_option1,
|
||||
remote_printer_t *p;
|
||||
cups_array_t *first_attributes_value;
|
||||
cups_array_t *second_attributes_value;
|
||||
- char *borderless_pagesize;
|
||||
+ char *borderless_pagesize = NULL;
|
||||
int option1_is_size = 0, option2_is_size = 0;
|
||||
+ unsigned long int max_length = 0, option1_len = 0, option2_len = 0, t_len = 0;
|
||||
char t[] = ".Borderless";
|
||||
|
||||
- borderless_pagesize = malloc(sizeof(char) * 32);
|
||||
+ t_len = strlen(t);
|
||||
+ if (option1)
|
||||
+ option1_len = strlen(option1);
|
||||
+ if (option2)
|
||||
+ option2_len = strlen(option2);
|
||||
+
|
||||
+ /* Seems to be possible to have both options...*/
|
||||
+ max_length = option1_len + option2_len + (2 * t_len) + 1;
|
||||
+
|
||||
+ borderless_pagesize = (char *)malloc(sizeof(char) * max_length);
|
||||
+ if (borderless_pagesize == NULL)
|
||||
+ {
|
||||
+ debug_printf("check_printer_with_options: Run out of memory.\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ memset(borderless_pagesize, 0, max_length);
|
||||
+
|
||||
if (!strcmp(ppd_keywords[idx_option1], "PageSize") ||
|
||||
!strcmp(ppd_keywords[idx_option1], "PageRegion")) {
|
||||
/* Check that we are generating .Borderless for the correct size, i.e We
|
||||
are generating 4x5.Borderless for 4x5 and not generating
|
||||
4x5.Borderless.Borderless for 4x5.Borderless */
|
||||
- if (strlen(option1) >= 11 &&
|
||||
- !strcmp(&option1[strlen(option1) - strlen(t)], t))
|
||||
+ if (option1_len >= 11 &&
|
||||
+ !strcmp(&option1[option1_len - t_len], t))
|
||||
;
|
||||
else {
|
||||
strcat(borderless_pagesize, option1);
|
||||
@@ -2512,8 +2529,8 @@ int check_printer_with_options(char* cluster_name, int idx_option1,
|
||||
}
|
||||
if (!strcmp(ppd_keywords[idx_option2], "PageSize") ||
|
||||
!strcmp(ppd_keywords[idx_option2], "PageRegion")) {
|
||||
- if(strlen(option2) >=11 &&
|
||||
- !strcmp(&option2[strlen(option2) - strlen(t)], t))
|
||||
+ if(option2_len >=11 &&
|
||||
+ !strcmp(&option2[option2_len - t_len], t))
|
||||
;
|
||||
else {
|
||||
strcat(borderless_pagesize, option2);
|
||||
@@ -2536,7 +2553,10 @@ int check_printer_with_options(char* cluster_name, int idx_option1,
|
||||
if (cupsArrayFind(second_attributes_value,(void*)option2) ||
|
||||
(option2_is_size && cupsArrayFind(second_attributes_value,
|
||||
(void*)borderless_pagesize)))
|
||||
+ {
|
||||
+ free(borderless_pagesize);
|
||||
return 1;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
free(borderless_pagesize);
|
@ -3,8 +3,8 @@
|
||||
|
||||
Summary: OpenPrinting CUPS filters and backends
|
||||
Name: cups-filters
|
||||
Version: 1.27.1
|
||||
Release: 2%{?dist}
|
||||
Version: 1.27.2
|
||||
Release: 1%{?dist}
|
||||
|
||||
# For a breakdown of the licensing, see COPYING file
|
||||
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
|
||||
@ -26,11 +26,10 @@ Patch01: cups-filters-createall.patch
|
||||
# have 'cups-filters' in path, because it is shipped in 'cups-filters' package
|
||||
# instead of 'cups-browsed' as Ubuntu does. I can repack the project later,
|
||||
# so cups-browsed would have separate sub package, so the link would be correct
|
||||
Patch02: cups-browsed.8.patch
|
||||
# crash on uninitialized string
|
||||
# reported upstream https://github.com/OpenPrinting/cups-filters/pull/204
|
||||
Patch03: cups-filters-abrt.patch
|
||||
Patch04: foomatic-rip-fix-empty-output.patch
|
||||
Patch02: cups-browsed.8.patch
|
||||
# Segfaults in test suite when test font is missing
|
||||
# https://github.com/OpenPrinting/cups-filters/pull/214
|
||||
Patch03: 0001-Fix-segfaults-in-test-suite-when-test-font-is-missin.patch
|
||||
|
||||
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
|
||||
|
||||
@ -141,9 +140,7 @@ This is the development package for OpenPrinting CUPS filters and backends.
|
||||
%patch01 -p1 -b .createall
|
||||
# links in manpage
|
||||
%patch02 -p1 -b .manpage
|
||||
# crash in cups-browsed
|
||||
%patch03 -p1 -b .abrt
|
||||
%patch04 -p1 -b .empty-output
|
||||
%patch03 -p1 -b .fontemb
|
||||
|
||||
%build
|
||||
# work-around Rpath
|
||||
@ -153,8 +150,6 @@ This is the development package for OpenPrinting CUPS filters and backends.
|
||||
# Brother, Minolta, and Konica Minolta to work around
|
||||
# bugs in the printer's PS interpreters
|
||||
# --with-rcdir=no - don't install SysV init script
|
||||
# --enable-auto-setup-driverless - enable automatic setup of IPP network printers
|
||||
# with driverless support
|
||||
# --enable-driverless - enable PPD generator for driverless printing in
|
||||
# /usr/lib/cups/driver, it is for manual setup of
|
||||
# driverless printers with printer setup tool
|
||||
@ -172,7 +167,7 @@ This is the development package for OpenPrinting CUPS filters and backends.
|
||||
--with-rcdir=no \
|
||||
--disable-mutool \
|
||||
--enable-driverless \
|
||||
--enable-auto-setup-driverless \
|
||||
--with-test-font-path=/usr/share/fonts/dejavu-sans-fonts/DejaVuSans.ttf \
|
||||
--enable-pclm
|
||||
|
||||
make %{?_smp_mflags}
|
||||
@ -312,6 +307,9 @@ done
|
||||
%{_libdir}/libfontembed.so
|
||||
|
||||
%changelog
|
||||
* Mon Mar 02 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.27.2-1
|
||||
- 1.27.2
|
||||
|
||||
* Tue Feb 25 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.27.1-2
|
||||
- 1806862 - foomatic-rip handles empty files in bad way
|
||||
|
||||
|
@ -1,193 +0,0 @@
|
||||
diff --git a/filter/foomatic-rip/foomaticrip.c b/filter/foomatic-rip/foomaticrip.c
|
||||
index 73ef28c..fb1c253 100644
|
||||
--- a/filter/foomatic-rip/foomaticrip.c
|
||||
+++ b/filter/foomatic-rip/foomaticrip.c
|
||||
@@ -560,8 +560,10 @@ int print_file(const char *filename, int convert)
|
||||
{
|
||||
FILE *file;
|
||||
char buf[8192];
|
||||
+ char tmpfilename[PATH_MAX];
|
||||
int type;
|
||||
int startpos;
|
||||
+ int pagecount;
|
||||
size_t n;
|
||||
int ret;
|
||||
|
||||
@@ -603,7 +605,6 @@ int print_file(const char *filename, int convert)
|
||||
char pdf2ps_cmd[CMDLINE_MAX];
|
||||
FILE *out, *in;
|
||||
int renderer_pid;
|
||||
- char tmpfilename[PATH_MAX] = "";
|
||||
|
||||
_log("Driver does not understand PDF input, "
|
||||
"converting to PostScript\n");
|
||||
@@ -615,7 +616,7 @@ int print_file(const char *filename, int convert)
|
||||
{
|
||||
int fd;
|
||||
FILE *tmpfile;
|
||||
-
|
||||
+
|
||||
snprintf(tmpfilename, PATH_MAX, "%s/foomatic-XXXXXX", temp_dir());
|
||||
fd = mkstemp(tmpfilename);
|
||||
if (fd < 0) {
|
||||
@@ -625,7 +626,7 @@ int print_file(const char *filename, int convert)
|
||||
tmpfile = fdopen(fd, "r+");
|
||||
copy_file(tmpfile, stdin, buf, n);
|
||||
fclose(tmpfile);
|
||||
-
|
||||
+
|
||||
filename = tmpfilename;
|
||||
}
|
||||
|
||||
@@ -668,6 +669,16 @@ int print_file(const char *filename, int convert)
|
||||
"Couldn't dup stdout of pdf-to-ps\n");
|
||||
|
||||
clearerr(stdin);
|
||||
+ pagecount = pdf_count_pages(filename);
|
||||
+ _log("File contains %d pages.\n", pagecount);
|
||||
+ if (pagecount < 0) {
|
||||
+ _log("Unexpected page_count\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (pagecount == 0) {
|
||||
+ _log("No pages left, outputting empty file.\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
ret = print_file("<STDIN>", 0);
|
||||
|
||||
wait_for_process(renderer_pid);
|
||||
@@ -687,7 +698,75 @@ int print_file(const char *filename, int convert)
|
||||
case PS_FILE:
|
||||
_log("Filetype: PostScript\n");
|
||||
if (file == stdin)
|
||||
- return print_ps(stdin, buf, n, filename);
|
||||
+ {
|
||||
+ if (convert)
|
||||
+ {
|
||||
+ int fd;
|
||||
+ FILE *tmpfile;
|
||||
+
|
||||
+ snprintf(tmpfilename, PATH_MAX, "%s/foomatic-XXXXXX", temp_dir());
|
||||
+ fd = mkstemp(tmpfilename);
|
||||
+ if (fd < 0) {
|
||||
+ _log("Could not create temporary file: %s\n", strerror(errno));
|
||||
+ return EXIT_PRNERR_NORETRY_BAD_SETTINGS;
|
||||
+ }
|
||||
+
|
||||
+ /* Copy already read data to the tmp file */
|
||||
+ if (write(fd,buf,n) != n) {
|
||||
+ _log("ERROR: Can't copy already read data to temporary file\n");
|
||||
+ close(fd);
|
||||
+ }
|
||||
+ /* Copy stdin to the tmp file */
|
||||
+ while ((n = read(0,buf,BUFSIZ)) > 0) {
|
||||
+ if (write(fd,buf,n) != n) {
|
||||
+ _log("ERROR: Can't copy stdin to temporary file\n");
|
||||
+ close(fd);
|
||||
+ }
|
||||
+ }
|
||||
+ /* Rewind tmp file to read it again */
|
||||
+ if (lseek(fd,0,SEEK_SET) < 0) {
|
||||
+ _log("ERROR: Can't rewind temporary file\n");
|
||||
+ close(fd);
|
||||
+ }
|
||||
+
|
||||
+ char gscommand[65536];
|
||||
+ char output[31] = "";
|
||||
+ int pagecount;
|
||||
+ size_t bytes;
|
||||
+ filename = strdup(tmpfilename);
|
||||
+ snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox %s 2>&1 | grep -c HiResBoundingBox",
|
||||
+ CUPS_GHOSTSCRIPT, filename);
|
||||
+ FILE *pd = popen(gscommand, "r");
|
||||
+ bytes = fread(output, 1, 31, pd);
|
||||
+ pclose(pd);
|
||||
+
|
||||
+ if (bytes <= 0 || sscanf(output, "%d", &pagecount) < 1)
|
||||
+ pagecount = -1;
|
||||
+
|
||||
+ if (pagecount < 0) {
|
||||
+ _log("Unexpected page_count\n");
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (pagecount == 0) {
|
||||
+ _log("No pages left, outputting empty file.\n");
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ _log("File contains %d pages.\n", pagecount);
|
||||
+
|
||||
+ if ((tmpfile = fdopen(fd,"rb")) == 0) {
|
||||
+ _log("ERROR: Can't fdopen temporary file\n");
|
||||
+ close(fd);
|
||||
+ }
|
||||
+ ret = print_ps(tmpfile, NULL, 0, filename);
|
||||
+ fclose(tmpfile);
|
||||
+ unlink(tmpfilename);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ else
|
||||
+ return print_ps(stdin, buf, n, filename);
|
||||
+ }
|
||||
else
|
||||
return print_ps(file, NULL, 0, filename);
|
||||
|
||||
diff --git a/filter/foomatic-rip/pdf.c b/filter/foomatic-rip/pdf.c
|
||||
index 1631f96..7364a73 100644
|
||||
--- a/filter/foomatic-rip/pdf.c
|
||||
+++ b/filter/foomatic-rip/pdf.c
|
||||
@@ -39,7 +39,7 @@
|
||||
static int wait_for_renderer();
|
||||
|
||||
|
||||
-static int pdf_count_pages(const char *filename)
|
||||
+int pdf_count_pages(const char *filename)
|
||||
{
|
||||
char gscommand[CMDLINE_MAX];
|
||||
char output[63] = "";
|
||||
diff --git a/filter/foomatic-rip/pdf.h b/filter/foomatic-rip/pdf.h
|
||||
index c9472a0..07e2f32 100644
|
||||
--- a/filter/foomatic-rip/pdf.h
|
||||
+++ b/filter/foomatic-rip/pdf.h
|
||||
@@ -25,6 +25,7 @@
|
||||
#define pdf_h
|
||||
|
||||
int print_pdf(FILE *s, const char *alreadyread, size_t len, const char *filename, size_t startpos);
|
||||
+int pdf_count_pages(const char *filemame);
|
||||
|
||||
#endif
|
||||
|
||||
diff --git a/filter/foomatic-rip/postscript.c b/filter/foomatic-rip/postscript.c
|
||||
index 8b6f0ad..f0ddf01 100644
|
||||
--- a/filter/foomatic-rip/postscript.c
|
||||
+++ b/filter/foomatic-rip/postscript.c
|
||||
@@ -322,7 +322,6 @@ void _print_ps(stream_t *stream)
|
||||
pid_t rendererpid = 0;
|
||||
FILE *rendererhandle = NULL;
|
||||
|
||||
- int empty = 1;
|
||||
int retval;
|
||||
|
||||
dstr_t *tmp = create_dstr();
|
||||
@@ -1010,7 +1009,6 @@ void _print_ps(stream_t *stream)
|
||||
/* No renderer running, start it */
|
||||
dstrcpy(tmp, psheader->data);
|
||||
dstrcat(tmp, psfifo->data);
|
||||
- empty = 0;
|
||||
get_renderer_handle(tmp, &rendererhandle, &rendererpid);
|
||||
/* psfifo is sent out, flush it */
|
||||
dstrclear(psfifo);
|
||||
@@ -1075,12 +1073,6 @@ void _print_ps(stream_t *stream)
|
||||
|
||||
} while ((maxlines == 0 || linect < maxlines) && more_stuff != 0);
|
||||
|
||||
- if (empty)
|
||||
- {
|
||||
- _log("No pages left, outputting empty file.\n");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
/* Some buffer still containing data? Send it out to the renderer */
|
||||
if (more_stuff || inheader || !isempty(psfifo->data)) {
|
||||
/* Flush psfifo and send the remaining data to the renderer, this
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (cups-filters-1.27.1.tar.xz) = 3fde635735138fa5ef511466b07f396f96860efcc51d9a01f5b95e86fc71ef48b9d17ba1bbe2eeb29585c3afc8bf26370b8f07df76a3adea2335be90e3fdb91b
|
||||
SHA512 (cups-filters-1.27.2.tar.xz) = c0e1456dd3f512ae2215e566f853e47b66de46d0d1301fc5a6f3674ac7d1ddb03c3bb236b0419b20168742076381c58581cc3e582cf7abf76139367d549a6c46
|
||||
|
Loading…
Reference in New Issue
Block a user