From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 17 11:32:15 2018 Received: (at 32181) by debbugs.gnu.org; 17 Jul 2018 15:32:15 +0000 Received: from localhost ([127.0.0.1]:45633 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffRxX-0007fA-7v for submit@debbugs.gnu.org; Tue, 17 Jul 2018 11:32:15 -0400 Received: from mout02.posteo.de ([185.67.36.66]:48601) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ffRxV-0007eu-Hb for 32181@debbugs.gnu.org; Tue, 17 Jul 2018 11:32:14 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 2C3B320F6B for <32181@debbugs.gnu.org>; Tue, 17 Jul 2018 17:32:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1531841527; bh=UdR42RBwjAkXhYHyEThQsXrp+mDmUfeM3xSd9BUjk6w=; h=From:To:Cc:Subject:Date:From; b=Zhx8/o3R/tJSEfV/Cxx+r+PFo2cE5hn+Si7rSH0TMoUXFYssJFiDcGQ+fa5UjxOFs eBcu9/XRq7bRkwyy/Cd9bwl556hSawqEdLIo6JntJI4bHPtAAn30tfcznDrxwCzCW/ KzHfZlXoOV0f3YhsPB/HwvgZlSFRWIoZqcEz7DwEHiwkzkJuQovn4+J9y3oS264X4p 97CTpp8h+AXhqyV+zzWzXlwEfrMyKX3DNVQ/sTLZgMyxkOv3NWPT/lmnYMyal8PfRA SP1KqKqsUPBh7Yx85j51PgMR9yMFEDix7ui/+IKxufZ+SXpXqwNz4cOxRdU7CaiMyo 6s8aYwH77iP4A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 41VPQs3FjSz6tm8; Tue, 17 Jul 2018 17:32:05 +0200 (CEST) From: Kei Kebreau To: Leo Famulari Subject: Re: [bug#32181] [PATCH] gnu: ghostscript: Fix CVE-2018-10194. References: Date: Tue, 17 Jul 2018 11:32:03 -0400 In-Reply-To: (Leo Famulari's message of "Mon, 16 Jul 2018 23:33:45 -0400") Message-ID: <87lga9zxn0.fsf@posteo.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 32181 Cc: 32181@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Leo Famulari writes: > * gnu/packages/ghostscript.scm (ghostscript)[replacement]: New field. > (ghostscript/fixed): New variable. > * gnu/packages/patches/ghostscript-CVE-2018-10194.patch: New file. > * gnu/local.mk (dist_patch_DATA): Add it. > --- > gnu/local.mk | 1 + > gnu/packages/ghostscript.scm | 11 ++++ > .../patches/ghostscript-CVE-2018-10194.patch | 52 +++++++++++++++++++ > 3 files changed, 64 insertions(+) > create mode 100644 gnu/packages/patches/ghostscript-CVE-2018-10194.patch > > diff --git a/gnu/local.mk b/gnu/local.mk > index d40b1963d..20a7d17e7 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -713,6 +713,7 @@ dist_patch_DATA =3D \ > %D%/packages/patches/geoclue-config.patch \ > %D%/packages/patches/ghc-8.0-fall-back-to-madv_dontneed.patch \ > %D%/packages/patches/ghc-dont-pass-linker-flags-via-response-files.pat= ch \ > + %D%/packages/patches/ghostscript-CVE-2018-10194.patch \ > %D%/packages/patches/ghostscript-no-header-id.patch \ > %D%/packages/patches/ghostscript-no-header-uuid.patch \ > %D%/packages/patches/ghostscript-no-header-creationdate.patch \ > diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm > index 0a6043ba6..1240b1dc1 100644 > --- a/gnu/packages/ghostscript.scm > +++ b/gnu/packages/ghostscript.scm > @@ -132,6 +132,7 @@ printing, and psresize, for adjusting page sizes.") > (define-public ghostscript > (package > (name "ghostscript") > + (replacement ghostscript/fixed) > (version "9.23") > (source > (origin > @@ -250,6 +251,16 @@ output file formats and printers.") > (home-page "https://www.ghostscript.com/") > (license license:agpl3+))) >=20=20 > +(define-public ghostscript/fixed > + (hidden-package > + (package > + (inherit ghostscript) > + (source > + (origin > + (inherit (package-source ghostscript)) > + (patches (append (origin-patches (package-source ghostscript)) > + (search-patches "ghostscript-CVE-2018-10194.p= atch")))))))) > + > (define-public ghostscript/x > (package/inherit ghostscript > (name (string-append (package-name ghostscript) "-with-x")) > diff --git a/gnu/packages/patches/ghostscript-CVE-2018-10194.patch b/gnu/= packages/patches/ghostscript-CVE-2018-10194.patch > new file mode 100644 > index 000000000..242e57c27 > --- /dev/null > +++ b/gnu/packages/patches/ghostscript-CVE-2018-10194.patch > @@ -0,0 +1,52 @@ > +Fix CVE-2018-10194: > + > +https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2018-10194 > +https://bugs.ghostscript.com/show_bug.cgi?id=3D699255 > + > +Patch copied from upstream source repository: > + > +https://git.ghostscript.com/?p=3Dghostpdl.git;a=3Dcommit;h=3D39b1e54b296= 8620723bf32e96764c88797714879 > + > +From 39b1e54b2968620723bf32e96764c88797714879 Mon Sep 17 00:00:00 2001 > +From: Ken Sharp > +Date: Wed, 18 Apr 2018 15:46:32 +0100 > +Subject: [PATCH] pdfwrite - Guard against trying to output an infinite n= umber > + > +Bug #699255 " Buffer overflow on pprintg1 due to mishandle postscript fi= le data to pdf" > + > +The file uses an enormous parameter to xyxhow, causing an overflow in > +the calculation of text positioning (value > 1e39). > + > +Since this is basically a nonsense value, and PostScript only supports > +real values up to 1e38, this patch follows the same approach as for > +a degenerate CTM, and treats it as 0. > + > +Adobe Acrobat Distiller throws a limitcheck error, so we could do that > +instead if this approach proves to be a problem. > +--- > + devices/vector/gdevpdts.c | 7 ++++++- > + 1 file changed, 6 insertions(+), 1 deletion(-) > + > +diff --git a/devices/vector/gdevpdts.c b/devices/vector/gdevpdts.c > +index 848ad781f..172fe6bc3 100644 > +--- a/devices/vector/gdevpdts.c > ++++ b/devices/vector/gdevpdts.c > +@@ -103,9 +103,14 @@ append_text_move(pdf_text_state_t *pts, double dw) > + static int > + set_text_distance(gs_point *pdist, double dx, double dy, const gs_matri= x *pmat) > + { > +- int code =3D gs_distance_transform_inverse(dx, dy, pmat, pdist); > ++ int code; > + double rounded; > +=20 > ++ if (dx > 1e38 || dy > 1e38) > ++ code =3D gs_error_undefinedresult; > ++ else > ++ code =3D gs_distance_transform_inverse(dx, dy, pmat, pdist); > ++ > + if (code =3D=3D gs_error_undefinedresult) { > + /* The CTM is degenerate. > + Can't know the distance in user space. > +--=20 > +2.18.0 > + I haven't built any dependent packages with this yet, but it builds properly on its own. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEg7ZwOtzKO2lLzi2m5qXuPBlGeg0FAltOC/MACgkQ5qXuPBlG eg3Buw/8DiFIsxVdzEEh/zl7kYYf8dhhjy0rpTZQYLba9FgmFf2479EzdTZSDmLL Kn1SJeHGRxWrhUypmhZOWWbfU7dbRRgb7I59fzjYFTzbuF8NzzosQaPybFO+dmuj 9ppJTkkrdVEp86nSpWdcgzJwJ1ag3wqt0Kso1t4gVcQEWiDz9lu9EdGRniAvMyGT HuzfKmohYC+5p0DnjVuDCgSEwXJkba95I5Lu8OT15KgrRrSU953P+pbM68WitbkO g6Nstub4W6YM8lPIgmATSAPMidK656Xo77xfBGCVxqhNMPvqaRcdPEf1wQsD/C5R xdZzSyv7jllEzJ5wGN64qAIBpIFMRa1ymBPmTR6wAeFF3L9kpdRYqL19ltTBpWeH wJ8qI10cMfW72M5KZiK5PUCJl2vVu7CmvZo2vsk4TPJzUg5JN7GgRsbftQsdqgwo t9GJT7BjmgO6pBkzOibwkuhqmVOOW0yW9OJPd/ZGCmvZ2NLCdER0qbuacUP727RY n/jLIHwlzh3hwaMoVc3zRHAh+wb7F3zbz5BbXwxwNsKzvILNaoEj1pk0mdmaXxel gdxW2/qhfbs5rJEFpC2C4dbhTmUWPcGYTk9qcPQaKgzoPIjtwmSyVTTKy+7xg6WM vg0UF0RV5vNkUZk649+lrp7tEB0r9cEmpm0SUTO5TQLqku27oq0= =jm1h -----END PGP SIGNATURE----- --=-=-=--