From owner-svn-ports-all@freebsd.org Fri Jun 15 21:24:42 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CEDE101D3E6; Fri, 15 Jun 2018 21:24:42 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E68E8846FD; Fri, 15 Jun 2018 21:24:41 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7C7A1CF60; Fri, 15 Jun 2018 21:24:41 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5FLOfsW069205; Fri, 15 Jun 2018 21:24:41 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5FLOfjt069204; Fri, 15 Jun 2018 21:24:41 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <201806152124.w5FLOfjt069204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Fri, 15 Jun 2018 21:24:41 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r472496 - in head/print/cups: . files X-SVN-Group: ports-head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: in head/print/cups: . files X-SVN-Commit-Revision: 472496 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2018 21:24:42 -0000 Author: tijl Date: Fri Jun 15 21:24:41 2018 New Revision: 472496 URL: https://svnweb.freebsd.org/changeset/ports/472496 Log: Add upstream patch to fix high CPU load. PR: 229051 Submitted by: tcberner Added: head/print/cups/files/patch-cups_ipp.c (contents, props changed) Modified: head/print/cups/Makefile Modified: head/print/cups/Makefile ============================================================================== --- head/print/cups/Makefile Fri Jun 15 21:23:01 2018 (r472495) +++ head/print/cups/Makefile Fri Jun 15 21:24:41 2018 (r472496) @@ -4,6 +4,7 @@ PORTNAME= cups PORTVERSION= 2.2.8 DISTVERSIONPREFIX=v +PORTREVISION= 1 CATEGORIES= print MAINTAINER= tijl@FreeBSD.org Added: head/print/cups/files/patch-cups_ipp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/print/cups/files/patch-cups_ipp.c Fri Jun 15 21:24:41 2018 (r472496) @@ -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 +--- cups/ipp.c ++++ 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);