Do not try to construct invalid rich media annotation assets

Resolves: #1665260
This commit is contained in:
Marek Kasik 2019-01-21 14:01:29 +01:00
parent ccc7adafd4
commit d39b5b6968
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 7f87dc10b6adccd6d1b977a28b064add254aa2da Mon Sep 17 00:00:00 2001
From: Adam Reichold <adam.reichold@t-online.de>
Date: Thu, 27 Dec 2018 11:54:53 +0100
Subject: [PATCH] Do not try to construct invalid rich media annotation assets.
Closes #703
---
poppler/Annot.cc | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 2e4770ab..1750dc70 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -6418,20 +6418,22 @@ AnnotRichMedia::Content::Content(Dict *dict) {
if (obj1.isDict()) {
Object obj2 = obj1.getDict()->lookup("Names");
if (obj2.isArray()) {
- nAssets = obj2.arrayGetLength() / 2;
+ const int length = obj2.arrayGetLength() / 2;
- assets = (Asset **)gmallocn(nAssets, sizeof(Asset *));
+ assets = (Asset **)gmallocn(length, sizeof(Asset *));
+ for (int i = 0; i < length; ++i) {
+ Object objKey = obj2.arrayGet(2 * i);
+ Object objVal = obj2.arrayGet(2 * i + 1);
- int counter = 0;
- for (int i = 0; i < nAssets; ++i) {
- assets[counter] = new AnnotRichMedia::Asset;
-
- Object objKey = obj2.arrayGet(i * 2);
- assets[counter]->fileSpec = obj2.arrayGet(i * 2 + 1);
-
- assets[counter]->name = new GooString( objKey.getString() );
- ++counter;
+ if (!objKey.isString() || objVal.isNull()) {
+ error(errSyntaxError, -1, "Bad Annot Asset");
+ continue;
+ }
+ assets[nAssets] = new AnnotRichMedia::Asset;
+ assets[nAssets]->name = new GooString( objKey.getString() );
+ assets[nAssets]->fileSpec = std::move(objVal);
+ ++nAssets;
}
}
}
--
2.20.1

View File

@ -4,7 +4,7 @@
Summary: PDF rendering library Summary: PDF rendering library
Name: poppler Name: poppler
Version: 0.67.0 Version: 0.67.0
Release: 6%{?dist} Release: 7%{?dist}
License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT License: (GPLv2 or GPLv3) and GPLv2+ and LGPLv2+ and MIT
URL: http://poppler.freedesktop.org/ URL: http://poppler.freedesktop.org/
Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz Source0: http://poppler.freedesktop.org/poppler-%{version}.tar.xz
@ -37,6 +37,9 @@ Patch11: poppler-0.67.0-valid-embedded-file.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1649450 # https://bugzilla.redhat.com/show_bug.cgi?id=1649450
Patch12: poppler-0.67.0-valid-embedded-file-name.patch Patch12: poppler-0.67.0-valid-embedded-file-name.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1665259
Patch13: poppler-0.67.0-rich-media-annotation.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: gettext-devel BuildRequires: gettext-devel
@ -267,6 +270,10 @@ test "$(pkg-config --modversion poppler-splash)" = "%{version}"
%{_mandir}/man1/* %{_mandir}/man1/*
%changelog %changelog
* Mon Jan 21 2019 Marek Kasik <mkasik@redhat.com> - 0.67.0-7
- Do not try to construct invalid rich media annotation assets
- Resolves: #1665260
* Thu Nov 15 2018 Marek Kasik <mkasik@redhat.com> - 0.67.0-6 * Thu Nov 15 2018 Marek Kasik <mkasik@redhat.com> - 0.67.0-6
- Check for valid file name of embedded file - Check for valid file name of embedded file
- Resolves: #1649451 - Resolves: #1649451