This commit is contained in:
Zdenek Dohnal 2023-04-27 14:44:17 +02:00
parent 91d4f55012
commit 177ffd57f4
5 changed files with 8 additions and 210 deletions

1
.gitignore vendored
View File

@ -112,3 +112,4 @@
/cups-filters-1.28.15.tar.xz
/cups-filters-1.28.16.tar.xz
/cups-filters-2.0b3.tar.gz
/cups-filters-2.0rc1.tar.gz

View File

@ -1,146 +0,0 @@
From 9ca26d04f170626a66a23cde3eac29dac7e89260 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Thu, 16 Feb 2023 15:49:10 +0100
Subject: [PATCH] Coverity fixes 2
---
filter/foomatic-rip/foomaticrip.c | 4 +++-
filter/foomatic-rip/options.c | 7 ++-----
filter/foomatic-rip/postscript.c | 11 +++++++----
filter/rastertoescpx.c | 3 +++
utils/driverless.c | 3 ++-
5 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/filter/foomatic-rip/foomaticrip.c b/filter/foomatic-rip/foomaticrip.c
index b6abe4d33..036d6138b 100644
--- a/filter/foomatic-rip/foomaticrip.c
+++ b/filter/foomatic-rip/foomaticrip.c
@@ -639,7 +639,7 @@ int
print_file(const char *filename,
int convert)
{
- FILE *file;
+ FILE *file = NULL;
char buf[8192];
char tmpfilename[PATH_MAX] = "";
int type;
@@ -664,6 +664,8 @@ print_file(const char *filename,
n = fread_or_die(buf, 1, sizeof(buf) - 1, file);
if (!n) {
_log("Input is empty, outputting empty file.\n");
+ if (strcasecmp(filename, "<STDIN>"))
+ fclose(file);
return (1);
}
buf[n] = '\0';
diff --git a/filter/foomatic-rip/options.c b/filter/foomatic-rip/options.c
index ae5bac2ed..bad833bc1 100644
--- a/filter/foomatic-rip/options.c
+++ b/filter/foomatic-rip/options.c
@@ -1255,8 +1255,6 @@ option_has_choice(option_t *opt,
const char *
option_text(option_t *opt)
{
- if (isempty(opt->text))
- return (opt->text);
return (opt->text);
}
@@ -2263,9 +2261,8 @@ ppd_supports_pdf()
// line
if (startswith(cmd, "gs"))
{
- strncpy(cmd_pdf, cmd, 4096);
- if (strlen(cmd) > 4095)
- cmd_pdf[4095] = '\0';
+ strncpy(cmd_pdf, cmd, 4095);
+ cmd_pdf[4095] = '\0';
return (1);
}
diff --git a/filter/foomatic-rip/postscript.c b/filter/foomatic-rip/postscript.c
index b09c5b8ff..e6fbd2ac0 100644
--- a/filter/foomatic-rip/postscript.c
+++ b/filter/foomatic-rip/postscript.c
@@ -178,17 +178,14 @@ print_ps(FILE *file,
const char *filename)
{
stream_t stream;
- char gscommand[65536];
int pagefound = 0;
FILE *in, *out;
pid_t pid;
- char buf[4096];
struct pollfd pfd;
size_t bytes, bytes_sent;
char *pos;
int pres;
- dstr_t *line = create_dstr();
- dstr_t *data_read = create_dstr();
+ dstr_t *line = NULL, *data_read = NULL;
// Define input data stream for reading
@@ -228,6 +225,11 @@ print_ps(FILE *file,
// lines, we only need the boolean answer whether there are pages or
// not
//
+
+ char buf[4096];
+ char gscommand[65536];
+ line = create_dstr();
+ data_read = create_dstr();
snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox -dDEVICEWIDTHPOINTS=1 -dDEVICEHEIGHTPOINTS=1 -_ 2>&1",
CUPS_GHOSTSCRIPT);
@@ -313,6 +315,7 @@ print_ps(FILE *file,
_log("No pages left, outputting empty file.\n");
free_dstr(data_read);
+ free_dstr(line);
}
return (1);
diff --git a/filter/rastertoescpx.c b/filter/rastertoescpx.c
index ccd599ea5..f060db0b3 100644
--- a/filter/rastertoescpx.c
+++ b/filter/rastertoescpx.c
@@ -335,6 +335,9 @@ StartPage(ppd_file_t *ppd, // I - PPD file
DitherLuts[6] = ppdLutLoad(ppd, colormodel, header->MediaType,
resolution, "LightBlack", logfunc, ld);
break;
+ default : // ERROR
+ fputs("ERROR: Unexpected number of channels\n", stderr);
+ exit(1);
}
for (plane = 0; plane < PrinterPlanes; plane ++)
diff --git a/utils/driverless.c b/utils/driverless.c
index 8af843333..7c67cbe19 100644
--- a/utils/driverless.c
+++ b/utils/driverless.c
@@ -495,19 +495,20 @@ list_printers (int mode, int reg_type_no, int isFax)
if (fp) {
while ((bytes = cupsFileGetLine(fp, buffer, sizeof(buffer))) > 0 ||
(bytes < 0 && (errno == EAGAIN || errno == EINTR))) {
- ippfind_output = (char *)malloc(MAX_OUTPUT_LEN*(sizeof(char)));
ptr = buffer;
while (ptr && !isalnum(*ptr & 255)) ptr ++;
if ((!strncasecmp(ptr, "ipps", 4) && ptr[4] == '\t')) {
ptr += 4;
*ptr = '\0';
ptr ++;
+ ippfind_output = (char *)malloc(MAX_OUTPUT_LEN*(sizeof(char)));
snprintf(ippfind_output, MAX_OUTPUT_LEN, "%s", ptr);
cupsArrayAdd(service_uri_list_ipps, ippfind_output);
} else if ((!strncasecmp(ptr, "ipp", 3) && ptr[3] == '\t')) {
ptr += 3;
*ptr = '\0';
ptr ++;
+ ippfind_output = (char *)malloc(MAX_OUTPUT_LEN*(sizeof(char)));
snprintf(ippfind_output, MAX_OUTPUT_LEN, "%s", ptr);
cupsArrayAdd(service_uri_list_ipp, ippfind_output);
} else
--
2.39.2

View File

@ -1,56 +0,0 @@
From 6872a5bf03a8001169af2348cb97de9557eee4e7 Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Thu, 2 Feb 2023 16:42:28 +0100
Subject: [PATCH] configure.ac: C++ not needed
---
INSTALL | 7 +++----
configure.ac | 5 +----
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/INSTALL b/INSTALL
index dd377fe54..f836bfa61 100644
--- a/INSTALL
+++ b/INSTALL
@@ -16,10 +16,9 @@ found in "CHANGES.md".
BEFORE YOU BEGIN
- You'll need ANSI-compliant C and C++ compilers, plus a make program and
- POSIX-compliant shell (/bin/sh). The GNU compiler tools and Bash work well
- and we have tested the current CUPS code against several versions of GCC
- with excellent results.
+ You'll need ANSI-compliant C, plus a make program and POSIX-compliant shell
+ (/bin/sh). The GNU compiler tools and Bash work well and we have tested
+ the current CUPS code against several versions of GCC with excellent results.
The Makefiles used by the project should work with most versions of make.
We've tested them with GNU make as well as the make programs shipped by
diff --git a/configure.ac b/configure.ac
index a3606c30f..affe7008d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ m4_include([m4/ax_compare_version.m4])
m4_include([m4/basic-directories.m4])
AM_INIT_AUTOMAKE([1.11 gnu dist-xz dist-bzip2 subdir-objects foreign])
AM_SILENT_RULES([yes])
-AC_LANG([C++])
+AC_LANG([C])
AC_CONFIG_HEADERS([config.h])
# Extra defines for the config.h
AH_BOTTOM([
@@ -50,11 +50,8 @@ AH_BOTTOM([
# Find required base packages
# ===========================
AC_PROG_CC
-AC_PROG_CXX
-AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory])
AM_PROG_CC_C_O
AM_ICONV
-AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AS_LN_SRF_PREPARE
--
2.39.1

View File

@ -9,13 +9,13 @@
# we build CUPS also with relro
%global _hardened_build 1
%global upstream_version 2.0b3
%global upstream_version 2.0rc1
Summary: OpenPrinting CUPS filters and backends for CUPS 2.X
Name: cups-filters
Epoch: 1
Version: 2.0~b3
Release: 2%{?dist}
Version: 2.0~rc1
Release: 1%{?dist}
# the CUPS exception text is the same as LLVM exception, so using that name with
# agreement from legal team
@ -27,10 +27,6 @@ Source0: %{URL}/releases/download/%{upstream_version}/%{name}-%{upstream_version
# Patches
# https://github.com/OpenPrinting/cups-filters/pull/504
Patch0001: 0001-configure.ac-C-not-needed.patch
# https://github.com/OpenPrinting/cups-filters/pull/510
Patch0002: 0001-Coverity-fixes.patch
# autogen.sh
@ -180,6 +176,9 @@ make check
%changelog
* Thu Apr 27 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~rc1-1
- 2.0rc1
* Wed Mar 01 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.0~b3-2
- use epoch to ensure clean upgrade path, because I didn't read FPG carefully

View File

@ -1 +1 @@
SHA512 (cups-filters-2.0b3.tar.gz) = a3667a05bcef3321b5901e08e6ff34a1f5366d5f2cf40a6767f7f5a66414baa724d82b36e58a2ea044a7b600af5798bdb265e012b8c86311318d052dd8fc6e8a
SHA512 (cups-filters-2.0rc1.tar.gz) = e42c0f6d77ccd9269f238876792f8c7695c025e0e717b16c7b32d5884b1aab5acc6eea38a9002f88ee48c5e9c13fdc2f1f6cac71e325e95461fbd44661661172