media-libs/exiftool: fix CVE-2021-22204

Bug: https://bugs.gentoo.org/785667
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
This commit is contained in:
Thomas Deutschmann
2021-05-03 15:57:33 +02:00
parent 0833928a53
commit 6d7a897605
2 changed files with 57 additions and 0 deletions
@@ -0,0 +1,27 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
DIST_NAME=Image-ExifTool
inherit perl-module
DESCRIPTION="Read and write meta information in image, audio and video files"
HOMEPAGE="https://exiftool.org/"
SRC_URI="https://exiftool.org/${DIST_P}.tar.gz"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 ~x86 ~x64-macos"
IUSE="doc"
PATCHES=( "${FILESDIR}"/exiftool-12.16-CVE-2021-22204.patch )
SRC_TEST="do"
src_install() {
perl-module_src_install
use doc && dodoc -r html/
insinto /usr/share/${PN}
doins -r fmt_files config_files arg_files
}
@@ -0,0 +1,30 @@
Description: Fix 'eval injection".
CVE-2021-22204: Improper neutralization of user data in the DjVu file
format in ExifTool versions 7.44 and up allows arbitrary code execution
when parsing the malicious image
Origin: upstream release 12.24
Bug-Debian: https://bugs.debian.org/987505
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1925985
Author: Phil Harvey <philharvey66@gmail.com>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2021-04-24
Applied-Upstream: https://github.com/exiftool/exiftool/commit/cf0f4e7dcd024ca99615bfd1102a841a25dde031#diff-fa0d652d10dbcd246e6b1df16c1e992931d3bb717a7e36157596b76bdadb3800
--- a/lib/Image/ExifTool/DjVu.pm
+++ b/lib/Image/ExifTool/DjVu.pm
@@ -227,10 +227,11 @@
last unless $tok =~ /(\\+)$/ and length($1) & 0x01;
$tok .= '"'; # quote is part of the string
}
- # must protect unescaped "$" and "@" symbols, and "\" at end of string
- $tok =~ s{\\(.)|([\$\@]|\\$)}{'\\'.($2 || $1)}sge;
- # convert C escape sequences (allowed in quoted text)
- $tok = eval qq{"$tok"};
+ # convert C escape sequences, allowed in quoted text
+ # (note: this only converts a few of them!)
+ my %esc = ( a => "\a", b => "\b", f => "\f", n => "\n",
+ r => "\r", t => "\t", '"' => '"', '\\' => '\\' );
+ $tok =~ s/\\(.)/$esc{$1}||'\\'.$1/egs;
} else { # key name
pos($$dataPt) = pos($$dataPt) - 1;
# allow anything in key but whitespace, braces and double quotes