This commit is contained in:
Zdenek Dohnal 2020-03-23 07:16:26 +01:00
parent 1fc0a67de9
commit 69c633e97b
5 changed files with 7 additions and 226 deletions

1
.gitignore vendored
View File

@ -95,3 +95,4 @@
/cups-filters-1.27.0.tar.xz
/cups-filters-1.27.1.tar.xz
/cups-filters-1.27.2.tar.xz
/cups-filters-1.27.3.tar.xz

View File

@ -1,121 +0,0 @@
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

View File

@ -1,95 +0,0 @@
diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
index 77efa583..dd0fcbb3 100644
--- a/utils/cups-browsed.c
+++ b/utils/cups-browsed.c
@@ -6278,6 +6278,7 @@ on_job_state (CupsNotifier *object,
}
ippDelete(response);
+ response = NULL;
} else
debug_printf("IPP request to %s:%d failed.\n", p->host,
p->port);
@@ -8070,7 +8071,7 @@ gboolean update_cups_queues(gpointer unused) {
debug_printf("Default page size: %s\n",
default_page_size);
p->num_options = cupsAddOption("media-default",
- strdup(default_page_size),
+ default_page_size,
p->num_options, &(p->options));
} else {
attr = ippFindAttribute(p->prattrs,
@@ -8081,7 +8082,7 @@ gboolean update_cups_queues(gpointer unused) {
debug_printf("Default page size: %s\n",
default_page_size);
p->num_options = cupsAddOption("media-default",
- strdup(default_page_size),
+ default_page_size,
p->num_options, &(p->options));
} else
debug_printf("No default page size found!\n");
@@ -8101,7 +8102,7 @@ gboolean update_cups_queues(gpointer unused) {
bottom = 1270;
snprintf(buffer, sizeof(buffer), "%d", bottom);
p->num_options = cupsAddOption("media-bottom-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
if ((attr = ippFindAttribute(p->prattrs,
@@ -8117,7 +8118,7 @@ gboolean update_cups_queues(gpointer unused) {
left = 635;
snprintf(buffer, sizeof(buffer), "%d", left);
p->num_options = cupsAddOption("media-left-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
if ((attr = ippFindAttribute(p->prattrs,
@@ -8133,7 +8134,7 @@ gboolean update_cups_queues(gpointer unused) {
right = 635;
snprintf(buffer, sizeof(buffer), "%d", right);
p->num_options = cupsAddOption("media-right-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
if ((attr = ippFindAttribute(p->prattrs,
@@ -8149,7 +8150,7 @@ gboolean update_cups_queues(gpointer unused) {
top = 1270;
snprintf(buffer, sizeof(buffer), "%d", top);
p->num_options = cupsAddOption("media-top-margin-default",
- strdup(buffer),
+ buffer,
p->num_options, &(p->options));
debug_printf("Margins: Left: %d, Right: %d, Top: %d, Bottom: %d\n",
@@ -8170,7 +8171,7 @@ gboolean update_cups_queues(gpointer unused) {
debug_printf("Best color space: %s\n",
best_color_space);
p->num_options = cupsAddOption("print-color-mode-default",
- strdup(best_color_space),
+ best_color_space,
p->num_options, &(p->options));
} else {
debug_printf("No info about supported color spaces found!\n");
@@ -8185,7 +8186,7 @@ gboolean update_cups_queues(gpointer unused) {
p->num_options, &(p->options));
p->num_options = cupsAddOption("output-format-default",
- strdup(p->pdl),
+ p->pdl,
p->num_options, &(p->options));
p->num_options = cupsAddOption("make-and-model-default",
remove_bad_chars(p->make_model, 0),
@@ -8527,8 +8528,8 @@ gboolean update_cups_queues(gpointer unused) {
/* Default option settings from printer entry */
for (i = 0; i < p->num_options; i ++)
if (strcasecmp(p->options[i].name, "printer-is-shared"))
- num_options = cupsAddOption(strdup(p->options[i].name),
- strdup(p->options[i].value),
+ num_options = cupsAddOption(p->options[i].name,
+ p->options[i].value,
num_options, &options);
/* Encode option list into IPP attributes */
cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);

View File

@ -3,8 +3,8 @@
Summary: OpenPrinting CUPS filters and backends
Name: cups-filters
Version: 1.27.2
Release: 2%{?dist}
Version: 1.27.3
Release: 1%{?dist}
# For a breakdown of the licensing, see COPYING file
# GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*,
@ -27,10 +27,6 @@ Patch01: cups-filters-createall.patch
# 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
# 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
Patch04: cups-browsed-leaks.patch
Requires: cups-filters-libs%{?_isa} = %{version}-%{release}
@ -145,8 +141,6 @@ This is the development package for OpenPrinting CUPS filters and backends.
%patch01 -p1 -b .createall
# links in manpage
%patch02 -p1 -b .manpage
%patch03 -p1 -b .fontemb
%patch04 -p1 -b .memleaks
%build
# work-around Rpath
@ -173,7 +167,6 @@ This is the development package for OpenPrinting CUPS filters and backends.
--with-rcdir=no \
--disable-mutool \
--enable-driverless \
--with-test-font-path=/usr/share/fonts/dejavu-sans-fonts/DejaVuSans.ttf \
--enable-pclm
make %{?_smp_mflags}
@ -313,6 +306,9 @@ done
%{_libdir}/libfontembed.so
%changelog
* Mon Mar 23 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.27.3-1
- 1.27.3
* Fri Mar 13 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1.27.2-2
- fix leaks in cups-browsed
- add require on nss-mdns

View File

@ -1 +1 @@
SHA512 (cups-filters-1.27.2.tar.xz) = c0e1456dd3f512ae2215e566f853e47b66de46d0d1301fc5a6f3674ac7d1ddb03c3bb236b0419b20168742076381c58581cc3e582cf7abf76139367d549a6c46
SHA512 (cups-filters-1.27.3.tar.xz) = 48c8a1d2ee860733a5cae41e333c45a997916638ea05552f2ec915d2713ecc216658763089affc8165907caf2b929406232192d70d0c0877b72377390b46ffd3