diff --git a/0001-gstoraster-Improved-detection-whether-input-is-PostS.patch b/0001-gstoraster-Improved-detection-whether-input-is-PostS.patch new file mode 100644 index 0000000..85d630a --- /dev/null +++ b/0001-gstoraster-Improved-detection-whether-input-is-PostS.patch @@ -0,0 +1,46 @@ +diff --git a/filter/gstoraster.c b/filter/gstoraster.c +index 0c9f37d..820acc8 100644 +--- a/filter/gstoraster.c ++++ b/filter/gstoraster.c +@@ -73,29 +73,23 @@ static GsDocType + parse_doc_type(FILE *fp) + { + char buf[5]; +- GsDocType doc_type; +- char *rc; ++ GsDocType type = GS_DOC_TYPE_UNKNOWN; + + /* get the first few bytes of the file */ +- doc_type = GS_DOC_TYPE_UNKNOWN; + rewind(fp); +- rc = fgets(buf,sizeof(buf),fp); +- if (rc == NULL) +- goto out; +- +- /* is PDF */ +- if (strncmp(buf,"%PDF",4) == 0) { +- doc_type = GS_DOC_TYPE_PDF; +- goto out; ++/* skip until PDF/PS start header */ ++ while (fgets(buf, sizeof(buf), fp) != 0) { ++ if (strncmp(buf, "%PDF", 4) == 0) ++ type = GS_DOC_TYPE_PDF; ++ if (strncmp(buf, "%!", 2) == 0) ++ type = GS_DOC_TYPE_PS; ++ if (type != GS_DOC_TYPE_UNKNOWN) ++ break; + } + +- /* is PS */ +- if (strncmp(buf,"%!",2) == 0) { +- doc_type = GS_DOC_TYPE_PS; +- goto out; +- } +-out: +- return doc_type; ++ rewind(fp); ++ ++ return (type); + } + + static void diff --git a/cups-filters.spec b/cups-filters.spec index 961efb7..6bbb9d6 100644 --- a/cups-filters.spec +++ b/cups-filters.spec @@ -11,7 +11,7 @@ Summary: OpenPrinting CUPS filters and backends Name: cups-filters Version: 1.20.0 -Release: 32%{?dist} +Release: 33%{?dist} # For a breakdown of the licensing, see COPYING file # GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*, @@ -69,6 +69,9 @@ Patch16: 0001-libcupsfilters-Fix-page-range-like-10-in-pdftopdf-fi.patch Patch17: gstoraster-margins.patch # CVE-2023-24805 cups-filters: remote code execution in cups-filters, beh CUPS backend Patch18: beh-cve2023.patch +# RHEL-19433 Incorrect PS header handling in gstopdf +Patch19: 0001-gstoraster-Improved-detection-whether-input-is-PostS.patch + %if %{with braille} Recommends: %{name}-braille%{?_isa} = %{version}-%{release} @@ -243,6 +246,8 @@ The package provides filters and cups-brf backend needed for braille printing. %patch17 -p1 -b .margins # CVE-2023-24805 cups-filters: remote code execution in cups-filters, beh CUPS backend %patch18 -p1 -b .cve202324805 +# RHEL-19433 Incorrect PS header handling in gstopdf +%patch19 -p1 -b .gstoraster-psdetect %build @@ -453,6 +458,9 @@ make check %endif %changelog +* Tue Dec 19 2023 Zdenek Dohnal - 1.20.0-33 +- RHEL-19433 Incorrect PS header handling in gstopdf + * Tue Aug 08 2023 Zdenek Dohnal - 1.20.0-32 - 2118406 - texttotext filter strips ESC causing PCL files to be printed improperly