poppler: fix CVE-2025-52885

Poppler ia a library for rendering PDF files, and examining or
modifying their structure. A use-after-free (write) vulnerability
has been detected in versions Poppler prior to 25.10.0 within the
StructTreeRoot class. The issue arises from the use of raw pointers
to elements of a `std::vector`, which can lead to dangling pointers
when the vector is resized. The vulnerability stems from the way that
refToParentMap stores references to `std::vector` elements using raw
pointers. These pointers may become invalid when the vector is resized.
This vulnerability is a common security problem involving the use of
raw pointers to `std::vectors`. Internally, `std::vector `stores its
elements in a dynamically allocated array. When the array reaches its
capacity and a new element is added, the vector reallocates a larger
block of memory and moves all the existing elements to the new location.
At this point if any pointers to elements are stored before a resize
occurs, they become dangling pointers once the reallocation happens.
Version 25.10.0 contains a patch for the issue.

Reference:
https://nvd.nist.gov/vuln/detail/CVE-2025-52885

Upstream patch:
https://gitlab.freedesktop.org/poppler/poppler/-/commit/4ce27cc826bf90cc8dbbd8a8c87bd913cccd7ec0

Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
This commit is contained in:
Yogita Urade
2025-10-16 11:48:25 +05:30
committed by Gyorgy Sarvari
parent 9146afcebb
commit 199ca4579c
2 changed files with 31 additions and 0 deletions
@@ -0,0 +1,30 @@
From 4ce27cc826bf90cc8dbbd8a8c87bd913cccd7ec0 Mon Sep 17 00:00:00 2001
From: Kevin Backhouse <kevinbackhouse@github.com>
Date: Wed, 3 Sep 2025 14:36:54 +0100
Subject: [PATCH] Check for duplicate entries
CVE: CVE-2025-52885
Upstream-Status: Backport [https://gitlab.freedesktop.org/poppler/poppler/-/commit/4ce27cc826bf90cc8dbbd8a8c87bd913cccd7ec0]
Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
---
poppler/StructTreeRoot.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/poppler/StructTreeRoot.cc b/poppler/StructTreeRoot.cc
index 47adac9..10db9aa 100644
--- a/poppler/StructTreeRoot.cc
+++ b/poppler/StructTreeRoot.cc
@@ -137,6 +137,10 @@ void StructTreeRoot::parseNumberTreeNode(Dict *node)
}
int keyVal = key.getInt();
std::vector<Parent> &vec = parentTree[keyVal];
+ if (!vec.empty()) {
+ error(errSyntaxError, -1, "Nums item at position {0:d} is a duplicate entry for key {1:d}", i, keyVal);
+ continue;
+ }
Object valueArray = nums.arrayGet(i + 1);
if (valueArray.isArray()) {
--
2.40.0
@@ -20,6 +20,7 @@ SRC_URI = "http://poppler.freedesktop.org/${BP}.tar.xz \
file://CVE-2025-52886-0003.patch \
file://CVE-2025-52886-0004.patch \
file://CVE-2025-43718.patch \
file://CVE-2025-52885.patch \
"
SRC_URI[sha256sum] = "813fb4b90e7bda63df53205c548602bae728887a60f4048aae4dbd9b1927deff"