From d1f63ce3dba7ae9cd0afde3a3c06bead707dda3e Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 21:35:03 +0100 Subject: [PATCH] added upstream patch to fix 100% cpu usage regression (https://github.com/apple/cups/issues/5325) [release 2.2.8-2mamba;Tue Jun 12 2018] --- ...8-fix-balidation-rejecting-all-names.patch | 60 +++++++++++++++++++ cups.spec | 7 ++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 cups-2.2.8-fix-balidation-rejecting-all-names.patch diff --git a/cups-2.2.8-fix-balidation-rejecting-all-names.patch b/cups-2.2.8-fix-balidation-rejecting-all-names.patch new file mode 100644 index 0000000..ef87b6a --- /dev/null +++ b/cups-2.2.8-fix-balidation-rejecting-all-names.patch @@ -0,0 +1,60 @@ +From 455c52a027ab3548953372a0b7bdb0008420e9ba Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +Date: Fri, 8 Jun 2018 22:29:50 +0200 +Subject: [PATCH] Fix validation rejecting all NAME and TEXT attrs + +When the UTF-8 validation loop finishes successfully, `*ptr` points at +the `'\0'` at the end of the string. The code misinterpreted this as a +control character (`*ptr < ' '`) and failed the validation. + +Fixes https://github.com/apple/cups/issues/5325 +--- + cups/ipp.c | 24 ++++++++++-------------- + 1 file changed, 10 insertions(+), 14 deletions(-) + +diff --git a/cups/ipp.c b/cups/ipp.c +index 95d53cc44..204c71fcd 100644 +--- a/cups/ipp.c ++++ b/cups/ipp.c +@@ -5030,15 +5030,13 @@ ippValidateAttribute( + else if (*ptr & 0x80) + break; + else if ((*ptr < ' ' && *ptr != '\n' && *ptr != '\r' && *ptr != '\t') || *ptr == 0x7f) +- break; ++ { ++ ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad control character (PWG 5100.14 section 8.3)."), attr->name, attr->values[i].string.text); ++ return (0); ++ } + } + +- if (*ptr < ' ' || *ptr == 0x7f) +- { +- ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad control character (PWG 5100.14 section 8.3)."), attr->name, attr->values[i].string.text); +- return (0); +- } +- else if (*ptr) ++ if (*ptr) + { + ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad text value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.2)."), attr->name, attr->values[i].string.text); + return (0); +@@ -5088,15 +5086,13 @@ ippValidateAttribute( + else if (*ptr & 0x80) + break; + else if (*ptr < ' ' || *ptr == 0x7f) +- break; ++ { ++ ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text); ++ return (0); ++ } + } + +- if (*ptr < ' ' || *ptr == 0x7f) +- { +- ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text); +- return (0); +- } +- else if (*ptr) ++ if (*ptr) + { + ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.3)."), attr->name, attr->values[i].string.text); + return (0); diff --git a/cups.spec b/cups.spec index a355a6e..672e247 100644 --- a/cups.spec +++ b/cups.spec @@ -7,7 +7,7 @@ Name: cups Version: 2.2.8 -Release: 1mamba +Release: 2mamba Summary: Common UNIX Printing System Group: System/Spooling Vendor: openmamba @@ -27,6 +27,7 @@ Patch0: %{name}-1.4.4-str3461-1.4.patch Patch1: %{name}-1.5.0-set_retry_job_default_ErrorPolicy.patch Patch2: cups-1.6.1-usb-backend-reset-after-job-only-for-specific-devices-3.patch Patch3: cups-1.7.0-statedir.patch +Patch4: cups-2.2.8-fix-balidation-rejecting-all-names.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel @@ -82,6 +83,7 @@ It is based on the "Internet Printing Protocol" and provides complete printing s %patch1 -p1 #%patch2 -p0 %patch3 -p1 +%patch4 -p1 %build autoconf @@ -300,6 +302,9 @@ fi #%doc CHANGES.txt README.txt %changelog +* Tue Jun 12 2018 Silvan Calarco 2.2.8-2mamba +- added upstream patch to fix 100% cpu usage regression (https://github.com/apple/cups/issues/5325) + * Tue Jun 05 2018 Automatic Build System 2.2.8-1mamba - automatic version update by autodist