0001-OutlineItem-open-Fix-crash-on-malformed-files.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From e5cc11e0b5b867f4705fd28ff1b981c1224be1cd Mon Sep 17 00:00:00 2001
  2. From: Albert Astals Cid <aacid@kde.org>
  3. Date: Wed, 17 May 2023 22:42:05 +0200
  4. Subject: [PATCH] OutlineItem::open: Fix crash on malformed files
  5. Fixes #1399
  6. Upstream: https://gitlab.freedesktop.org/poppler/poppler/-/commit/591235c8b6c65a2eee88991b9ae73490fd9afdfe
  7. [Thomas: backported to fix CVE-2023-34872]
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  9. ---
  10. poppler/Outline.cc | 10 +++++++---
  11. 1 file changed, 7 insertions(+), 3 deletions(-)
  12. diff --git a/poppler/Outline.cc b/poppler/Outline.cc
  13. index cbb6cb49..4c68be99 100644
  14. --- a/poppler/Outline.cc
  15. +++ b/poppler/Outline.cc
  16. @@ -14,7 +14,7 @@
  17. // under GPL version 2 or later
  18. //
  19. // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com>
  20. -// Copyright (C) 2008, 2016-2019, 2021 Albert Astals Cid <aacid@kde.org>
  21. +// Copyright (C) 2008, 2016-2019, 2021, 2023 Albert Astals Cid <aacid@kde.org>
  22. // Copyright (C) 2009 Nick Jones <nick.jones@network-box.com>
  23. // Copyright (C) 2016 Jason Crain <jason@aquaticape.us>
  24. // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
  25. @@ -483,8 +483,12 @@ void OutlineItem::open()
  26. {
  27. if (!kids) {
  28. Object itemDict = xref->fetch(ref);
  29. - const Object &firstRef = itemDict.dictLookupNF("First");
  30. - kids = readItemList(this, &firstRef, xref, doc);
  31. + if (itemDict.isDict()) {
  32. + const Object &firstRef = itemDict.dictLookupNF("First");
  33. + kids = readItemList(this, &firstRef, xref, doc);
  34. + } else {
  35. + kids = new std::vector<OutlineItem *>();
  36. + }
  37. }
  38. }
  39. --
  40. 2.41.0