aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/exiv2-CVE-2017-14860.patch
blob: 43e6076b71f2da97bf9df4388f536f487cedb508 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Fix CVE-2017-14860.

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14860
https://nvd.nist.gov/vuln/detail/CVE-2017-14860

Copied from upstream:

https://github.com/Exiv2/exiv2/commit/ff18fec24b119579df26fd2ebb8bb012cde102ce

From ff18fec24b119579df26fd2ebb8bb012cde102ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dan.cermak@cgc-instruments.com>
Date: Fri, 6 Oct 2017 23:09:08 +0200
Subject: [PATCH] Fix for CVE-2017-14860

A heap buffer overflow could occur in memcpy when icc.size_ is larger
than data.size_ - pad, as then memcpy would read out of bounds of data.

This commit adds a sanity check to iccLength (= icc.size_): if it is
larger than data.size_ - pad (i.e. an overflow would be caused) an
exception is thrown.

This fixes #71.
---
 src/jp2image.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/jp2image.cpp b/src/jp2image.cpp
index 747145cf..748d39b5 100644
--- a/src/jp2image.cpp
+++ b/src/jp2image.cpp
@@ -269,10 +269,15 @@ namespace Exiv2
                             std::cout << "Exiv2::Jp2Image::readMetadata: "
                                      << "Color data found" << std::endl;
 #endif
-                            long pad = 3 ; // 3 padding bytes 2 0 0
+                            const long pad = 3 ; // 3 padding bytes 2 0 0
                             DataBuf data(subBox.length+8);
                             io_->read(data.pData_,data.size_);
-                            long    iccLength = getULong(data.pData_+pad, bigEndian);
+                            const long    iccLength = getULong(data.pData_+pad, bigEndian);
+                            // subtracting pad from data.size_ is safe:
+                            // size_ is at least 8 and pad = 3
+                            if (iccLength > data.size_ - pad) {
+                                throw Error(58);
+			    }
                             DataBuf icc(iccLength);
                             ::memcpy(icc.pData_,data.pData_+pad,icc.size_);
 #ifdef DEBUG
ILE-GCRYPT to the search path. 2018-08-24import: cpan: Adjust test to new URL.Ludovic Courtès This is a followup to 9aba9b127840a116c806a2cbac901cf8077abcd0. * tests/cpan.scm ("cpan->guix-package"): Adjust 'home-page' URL. 2017-10-30Revert "import: cpan: Use HTTPS for home pages."Tobias Geerinckx-Rice This reverts commit 29f7bf59d5d4d4b848eaedc6766bb4e02cae20d3: HTTPS support at search.cpan.org is unreliable, at best. Don't rely on it. 2017-10-29import: cpan: Use HTTPS for home pages.Tobias Geerinckx-Rice * guix/import/cpan.scm (cpan-home): Use HTTPS. * tests/cpan.scm ("cpan->guix-package"): Expect it. 2017-10-28import: cpan: Add trailing "/" on home-page.Eric Bavier This appeases 'guix lint', which otherwise complains about permanent redirects. * guix/import/cpan.scm (cpan-module->sexp): Add trailing "/" on home-page. * tests/cpan.scm ("cpan->guix-package"): Adjust accordingly. 2017-10-28import: cpan: Propagate imported dependencies.Eric Bavier This is most often the need for perl module dependencies. * guix/import/cpan.scm (cpan-module->sexp): 'inputs -> 'propagated-inputs. * tests/cpan.scm ("cpan->guix-package"): Adjust accordingly. 2017-09-14import: cpan: Adjust expected license in tests.Ludovic Courtès This is a followup to 01ef804d69b2e57dd7b1d3d13e66e3f67e7c548a. * tests/cpan.scm ("cpan->guix-package"): Expect 'perl-license'. 2017-06-07import: cpan: Update CPAN importer to use MetaCPAN v1 API.James Richardson * guix/import/cpan.scm (module->dist-name, cpan-fetch): Use metacpan.org URLs. * tests/cpan.scm ("cpan->guix-package"): Adjust accordingly. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2017-02-13tests: Adjust for 'http-fetch' change in (guix import json).Ludovic Courtès This is a followup to commit 81e0bc1834490a1a8092c75a0733b15c2b407285. * tests/cpan.scm ("cpan->guix-package"): Add a 'rest' argument to the lambda that mocks 'http-fetch'. * tests/crate.scm ("crate->guix-package"): Likewise. * tests/gem.scm ("gem->guix-package"): Likewise. * tests/pypi.scm ("pypi->guix-package"): Likewise. ("pypi->guix-package, wheels"): Likewise. 2016-12-18tests: Mock up http-fetch.Ricardo Wurmus This is a follow-up to commit 63773200d7ac68fcaee6efd9ffe8ea7aa3fafa38. * tests/cpan.scm ("cpan->guix-package"): Add mock definition of http-fetch. 2016-12-18tests: Adjust cpan tests.Ricardo Wurmus This is a follow-up to commit ff55fe559951b88bfd691b9dada3a0f26002c4cb. * tests/cpan.scm (source-url-http, source-url-https): Use cpan-source-url. 2016-11-10tests: Adjust 'url-fetch' mocks to TLS changes.Ludovic Courtès This is a followup to bc3c41ce36349ed4ec758c70b48a7059e363043a. * tests/cpan.scm ("cpan->guix-package"): Add #:verify-certificate? parameter in 'url-fetch' mock. * tests/cran.scm ("description->package"): Likewise. 2016-08-31tests: cpan: Fix mock urls.Eric Bavier Followup to 7a62263ee5. * tests/cpan.scm (cpan->guix-package): Use "https" in mock urls. 2016-07-03import: cpan: Use our mirrors for 'https' URLs.Alex Sassmannshausen * guix/import/cpan.scm (fix-source-url): New procedure. (cpan-module->sexp): Use it to construct our source-url. * tests/cpan.scm: Add tests for fix-source-url. Signed-off-by: Ludovic Courtès <ludo@gnu.org>