Version in base suite: 25.04.2-1+deb13u1 Base version: okular_25.04.2-1+deb13u1 Target version: okular_25.04.2-1+deb13u2 Base file: /srv/ftp-master.debian.org/ftp/pool/main/o/okular/okular_25.04.2-1+deb13u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/o/okular/okular_25.04.2-1+deb13u2.dsc changelog | 10 patches/CVE-2026-124454.patch | 801 ++++++++++++++++++++++++++++++++++++++++++ patches/series | 1 3 files changed, 812 insertions(+) dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmp9l9fe00j/okular_25.04.2-1+deb13u1.dsc: no acceptable signature found dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmp9l9fe00j/okular_25.04.2-1+deb13u2.dsc: no acceptable signature found diff -Nru okular-25.04.2/debian/changelog okular-25.04.2/debian/changelog --- okular-25.04.2/debian/changelog 2026-06-08 11:52:53.000000000 +0000 +++ okular-25.04.2/debian/changelog 2026-11-29 03:49:00.000000000 +0000 @@ -1,3 +1,13 @@ +okular (4:25.04.2-1+deb13u2) trixie-security; urgency=medium + + * Backport fix for CVE-2026-124454 + This patch fixes a use-after-free caused by unclear object ownership and + usage between the Javascript engine and the surrounding C++ code, which + can lead to arbitrary code execution from opening a specially crafted PDF + file. + + -- Maytham Alsudany Sun, 29 Nov 2026 11:49:00 +0800 + okular (4:25.04.2-1+deb13u1) trixie-security; urgency=medium * Multiple security issues in parsing Fax files diff -Nru okular-25.04.2/debian/patches/CVE-2026-124454.patch okular-25.04.2/debian/patches/CVE-2026-124454.patch --- okular-25.04.2/debian/patches/CVE-2026-124454.patch 1970-01-01 00:00:00.000000000 +0000 +++ okular-25.04.2/debian/patches/CVE-2026-124454.patch 2026-11-29 03:49:00.000000000 +0000 @@ -0,0 +1,801 @@ +From: Sune Vuorela +From: Albert Astals Cid +From: Maytham Alsudany +Subject: Backport fix for CVE-2026-124454 + +This patch fixes a use-after-free caused by unclear object ownership and usage +between the Javascript engine and the surrounding C++ code, which can lead to +arbitrary code execution from opening a specially crafted PDF file. + +This patch backports the commits required to fix CVE-2026-124454 (arbitrary +code execution in Javascript engine) as per the commits listed in +https://kde.org/info/security/advisory-20261112-1.txt (bottom to top). +The commits labelled "not essential" have not been included. + +The changes are: +- Check action is of type Script before static casting to it. +- Change executeScriptEvent (core/document.cpp) to accept a reference (&) + rather than a pointer (*) to make it clear null is not a valid value. +- Change event from pointer (Event*) to a shared pointer (const + std::shared_ptr). +- Prevent timers from outliving the current JS application: switch QTimer's + parent to "this" in JSApp::setTimeOut and JSApp::setInterval + (core/script/js_app.cpp). +- Ensure global objects, including event, that are referenced by C++ code + outlive the Javascript handling in core/script/executor_js.cpp by specifying + CppOwnership. +- Move field cache to document scope to ensure that one document getting closed + doesn't destroy cache from other documents. +- Move interval timers to document scope to ensure that closing a document + doesn't invalidate intervals from other documents. + +The main difference between this patch and upstream is that upstream uses a +queue for events (m_events), whereas here each event is passed as a pointer +(patched to std::shared_ptr) directly to ExecutorJS::execute, without +any updateEvent method. + +--- a/core/document.cpp ++++ b/core/document.cpp +@@ -1206,14 +1206,14 @@ + for (FormField *form : forms) { + if (form->id() == formId) { + const Action *action = form->additionalAction(FormField::CalculateField); +- if (action) { ++ if (action && action->actionType() == Action::Script) { + std::shared_ptr event; + QString oldVal; + if (dynamic_cast(form) || dynamic_cast(form)) { + // Prepare text calculate event + event = Event::createFormCalculateEvent(form, m_pagesVector[pageIdx]); + const ScriptAction *linkscript = static_cast(action); +- executeScriptEvent(event, linkscript); ++ executeScriptEvent(event, *linkscript); + // The value maybe changed in javascript so save it first. + oldVal = form->value().toString(); + +@@ -2254,13 +2254,18 @@ + return foundPage; + } + +-void DocumentPrivate::executeScriptEvent(const std::shared_ptr &event, const Okular::ScriptAction *linkscript) ++void DocumentPrivate::executeScriptEvent(const std::shared_ptr &event, const Okular::ScriptAction &linkscript) ++{ ++ executeScriptEvent(event, linkscript.scriptType(), linkscript.script()); ++} ++ ++void DocumentPrivate::executeScriptEvent(const std::shared_ptr &event, ScriptType type, const QString &script) + { + if (!m_scripter) { + m_scripter = new Scripter(this); + } +- m_scripter->setEvent(event.get()); +- m_scripter->execute(linkscript->scriptType(), linkscript->script()); ++ m_scripter->setEvent(event); ++ m_scripter->execute(type, script); + + // Clear out the event after execution + m_scripter->setEvent(nullptr); +@@ -2595,9 +2600,8 @@ + if (!docScripts.isEmpty()) { + d->m_scripter = new Scripter(d); + for (const QString &docscript : docScripts) { +- const Okular::ScriptAction *linkScript = new Okular::ScriptAction(Okular::JavaScript, docscript); + std::shared_ptr event = Event::createDocEvent(Event::DocOpen); +- d->executeScriptEvent(event, linkScript); ++ d->executeScriptEvent(event, Okular::JavaScript, docscript); + } + } + +@@ -4403,7 +4407,7 @@ + + const ScriptAction *linkscript = static_cast(action); + +- d->executeScriptEvent(event, linkscript); ++ d->executeScriptEvent(event, *linkscript); + + const QString formattedText = event->value().toString(); + ff->commitFormattedValue(formattedText); +@@ -4515,7 +4519,7 @@ + event->setChange(DocumentPrivate::evaluateKeystrokeEventChange(inputString, newValue.toString(), selStart, selEnd)); + const ScriptAction *linkscript = static_cast(action); + +- d->executeScriptEvent(event, linkscript); ++ d->executeScriptEvent(event, *linkscript); + + if (event->returnCode()) { + ff->setValue(newValue); +@@ -4555,7 +4559,7 @@ + + const ScriptAction *linkscript = static_cast(action); + +- d->executeScriptEvent(event, linkscript); ++ d->executeScriptEvent(event, *linkscript); + + if (!event->returnCode()) { + ff->setValue(QVariant(ff->committedFormattedValue())); +@@ -4586,7 +4590,7 @@ + + const ScriptAction *linkscript = static_cast(action); + +- d->executeScriptEvent(event, linkscript); ++ d->executeScriptEvent(event, *linkscript); + } + + void Document::processValidateAction(const Action *action, Okular::FormFieldText *fft, bool &returnCode) +@@ -4612,7 +4616,7 @@ + + const ScriptAction *linkscript = static_cast(action); + +- d->executeScriptEvent(event, linkscript); ++ d->executeScriptEvent(event, *linkscript); + if (!event->returnCode()) { + ff->setValue(QVariant(ff->committedFormattedValue())); + Q_EMIT refreshFormWidget(ff); +@@ -4689,7 +4693,7 @@ + + const ScriptAction *linkScript = static_cast(action); + +- d->executeScriptEvent(event, linkScript); ++ d->executeScriptEvent(event, *linkScript); + } + + void Document::processFormMouseScriptAction(const Action *action, Okular::FormField *ff, MouseEventType fieldMouseEventType) +@@ -4727,7 +4731,7 @@ + + const ScriptAction *linkscript = static_cast(action); + +- d->executeScriptEvent(event, linkscript); ++ d->executeScriptEvent(event, *linkscript); + } + + void Document::processFormMouseUpScripAction(const Action *action, Okular::FormField *ff) +--- a/core/document_p.h ++++ b/core/document_p.h +@@ -9,8 +9,10 @@ + #define _OKULAR_DOCUMENT_P_H_ + + #include "document.h" ++#include "global.h" + #include "script/event_p.h" + ++#include "signatureutils.h" + #include "synctex/synctex_parser.h" + #include + +@@ -243,7 +245,8 @@ + /* + * Executes a ScriptAction with the event passed as parameter. + */ +- void executeScriptEvent(const std::shared_ptr &event, const Okular::ScriptAction *linkscript); ++ void executeScriptEvent(const std::shared_ptr &event, const Okular::ScriptAction &linkscript); ++ void executeScriptEvent(const std::shared_ptr &event, ScriptType type, const QString &script); + + /* + * Find the corresponding page number for the form field passed as parameter. +--- a/core/script/executor_js.cpp ++++ b/core/script/executor_js.cpp +@@ -50,10 +50,25 @@ + void initTypes(); + + DocumentPrivate *m_doc; ++ std::unique_ptr m_jsapp; ++ std::unique_ptr m_jsconsole; ++ std::unique_ptr m_jsdocument; ++ std::unique_ptr m_jsdisplay; ++ std::unique_ptr m_jsspell; ++ std::unique_ptr m_jsutil; ++ std::unique_ptr m_jsglobal; ++ std::shared_ptr m_fieldCache = std::make_shared(); + QJSEngine m_interpreter; + + QThread m_watchdogThread; + QTimer *m_watchdogTimer = nullptr; ++ ++ void installGlobalCppProperty(const QString &name, QObject *value) ++ { ++ auto jsValue = m_interpreter.newQObject(value); ++ QJSEngine::setObjectOwnership(value, QJSEngine::CppOwnership); ++ m_interpreter.globalObject().setProperty(name, jsValue); ++ } + }; + + void ExecutorJSPrivate::initTypes() +@@ -66,13 +81,22 @@ + QObject::connect( + m_watchdogTimer, &QTimer::timeout, &m_interpreter, [this]() { m_interpreter.setInterrupted(true); }, Qt::DirectConnection); + +- m_interpreter.globalObject().setProperty(QStringLiteral("app"), m_interpreter.newQObject(new JSApp(m_doc, m_watchdogTimer))); +- m_interpreter.globalObject().setProperty(QStringLiteral("console"), m_interpreter.newQObject(new JSConsole)); +- m_interpreter.globalObject().setProperty(QStringLiteral("Doc"), m_interpreter.newQObject(new JSDocument(m_doc))); +- m_interpreter.globalObject().setProperty(QStringLiteral("display"), m_interpreter.newQObject(new JSDisplay)); +- m_interpreter.globalObject().setProperty(QStringLiteral("spell"), m_interpreter.newQObject(new JSSpell)); +- m_interpreter.globalObject().setProperty(QStringLiteral("util"), m_interpreter.newQObject(new JSUtil)); +- m_interpreter.globalObject().setProperty(QStringLiteral("global"), m_interpreter.newQObject(new JSGlobal)); ++ m_jsapp = std::make_unique(m_doc, m_watchdogTimer); ++ installGlobalCppProperty(QStringLiteral("app"), m_jsapp.get()); ++ m_jsconsole = std::make_unique(); ++ installGlobalCppProperty(QStringLiteral("console"), m_jsconsole.get()); ++ m_jsapp = std::make_unique(m_doc, m_watchdogTimer); ++ installGlobalCppProperty(QStringLiteral("app"), m_jsapp.get()); ++ m_jsdocument = std::make_unique(m_doc, m_fieldCache); ++ installGlobalCppProperty(QStringLiteral("Doc"), m_jsdocument.get()); ++ m_jsdisplay = std::make_unique(); ++ installGlobalCppProperty(QStringLiteral("display"), m_jsdisplay.get()); ++ m_jsspell = std::make_unique(); ++ installGlobalCppProperty(QStringLiteral("spell"), m_jsspell.get()); ++ m_jsutil = std::make_unique(); ++ installGlobalCppProperty(QStringLiteral("util"), m_jsutil.get()); ++ m_jsglobal = std::make_unique(); ++ installGlobalCppProperty(QStringLiteral("global"), m_jsglobal.get()); + } + + ExecutorJS::ExecutorJS(DocumentPrivate *doc) +@@ -82,15 +106,17 @@ + + ExecutorJS::~ExecutorJS() + { +- JSField::clearCachedFields(); +- JSApp::clearCachedFields(); + delete d; + } + +-void ExecutorJS::execute(const QString &script, Event *event) ++void ExecutorJS::execute(const QString &script, const std::shared_ptr &event) + { +- const auto eventVal = event ? d->m_interpreter.newQObject(new JSEvent(event)) : QJSValue(QJSValue::UndefinedValue); +- d->m_interpreter.globalObject().setProperty(QStringLiteral("event"), eventVal); ++ if (event) { ++ std::unique_ptr m_event = std::make_unique(event, d->m_fieldCache); ++ d->installGlobalCppProperty(QStringLiteral("event"), m_event.get()); ++ } else { ++ d->m_interpreter.globalObject().setProperty(QStringLiteral("event"), QJSValue(QJSValue::UndefinedValue)); ++ } + + QMetaObject::invokeMethod(d->m_watchdogTimer, qOverload<>(&QTimer::start)); + d->m_interpreter.setInterrupted(false); +--- a/core/script/executor_js_p.h ++++ b/core/script/executor_js_p.h +@@ -8,6 +8,7 @@ + #define OKULAR_SCRIPT_EXECUTOR_JS_P_H + + class QString; ++#include + + namespace Okular + { +@@ -24,7 +25,7 @@ + ExecutorJS(const ExecutorJS &) = delete; + ExecutorJS &operator=(const ExecutorJS &) = delete; + +- void execute(const QString &script, Event *event); ++ void execute(const QString &script, const std::shared_ptr &event); + + private: + friend class ExecutorJSPrivate; +--- a/core/script/js_event.cpp ++++ b/core/script/js_event.cpp +@@ -49,7 +49,7 @@ + if (m_event->eventType() == Event::FieldCalculate) { + FormField *src = m_event->source(); + if (src) { +- return JSField::wrapField(qjsEngine(this), src, m_event->sourcePage()); ++ return JSField::wrapField(qjsEngine(this), src, m_event->sourcePage(), m_fieldCache); + } + } + return QJSValue(QJSValue::UndefinedValue); +@@ -70,7 +70,7 @@ + case Event::FieldMouseExit: { + FormField *target = static_cast(m_event->target()); + if (target) { +- return JSField::wrapField(qjsEngine(this), target, m_event->targetPage()); ++ return JSField::wrapField(qjsEngine(this), target, m_event->targetPage(), m_fieldCache); + } + break; + } +@@ -136,9 +136,10 @@ + return m_event->selEnd(); + } + +-JSEvent::JSEvent(Event *event, QObject *parent) ++JSEvent::JSEvent(const std::shared_ptr &event, const std::shared_ptr &fieldCache, QObject *parent) + : QObject(parent) + , m_event(event) ++ , m_fieldCache(fieldCache) + { + } + +--- a/core/script/js_event_p.h ++++ b/core/script/js_event_p.h +@@ -13,6 +13,7 @@ + namespace Okular + { + class Event; ++class JSFieldCache; + + class JSEvent : public QObject + { +@@ -31,7 +32,7 @@ + Q_PROPERTY(int selEnd READ selEnd CONSTANT) + + public: +- explicit JSEvent(Event *event, QObject *parent = nullptr); ++ explicit JSEvent(const std::shared_ptr &event, const std::shared_ptr &fieldCache, QObject *parent = nullptr); + ~JSEvent() override; + + QString name() const; +@@ -51,7 +52,8 @@ + int selEnd() const; + + private: +- Event *m_event = nullptr; ++ std::shared_ptr m_event; ++ std::shared_ptr m_fieldCache; + }; + + } +--- a/core/scripter.cpp ++++ b/core/scripter.cpp +@@ -24,7 +24,6 @@ + #if HAVE_JS + , m_js(nullptr) + #endif +- , m_event(nullptr) + { + } + +@@ -32,7 +31,7 @@ + #if HAVE_JS + QScopedPointer m_js; + #endif +- Event *m_event; ++ std::shared_ptr m_event; + }; + + Scripter::Scripter(DocumentPrivate *doc) +@@ -70,12 +69,12 @@ + #endif + } + +-void Scripter::setEvent(Event *event) ++void Scripter::setEvent(const std::shared_ptr &event) + { + d->m_event = event; + } + +-Event *Scripter::event() const ++std::shared_ptr Scripter::event() const + { + return d->m_event; + } +--- a/core/scripter.h ++++ b/core/scripter.h +@@ -8,6 +8,7 @@ + #define OKULAR_SCRIPTER_H + + #include "global.h" ++#include + + class QString; + +@@ -31,8 +32,8 @@ + + void execute(ScriptType type, const QString &script); + +- void setEvent(Event *event); +- Event *event() const; ++ void setEvent(const std::shared_ptr &event); ++ std::shared_ptr event() const; + + private: + friend class ScripterPrivate; +--- a/core/script/js_app.cpp ++++ b/core/script/js_app.cpp +@@ -27,9 +27,6 @@ + + #define OKULAR_TIMERID QStringLiteral("okular_timerID") + +-typedef QHash TimerCache; +-Q_GLOBAL_STATIC(TimerCache, g_timerCache) +- + // the acrobat version we fake + static const double fake_acroversion = 8.00; + +@@ -285,9 +282,9 @@ + // app.setInterval() + QJSValue JSApp::setInterval(const QString &cExpr, int nMilliseconds) + { +- QTimer *timer = new QTimer(); ++ QTimer *timer = new QTimer(this); + +- QObject::connect(timer, &QTimer::timeout, m_doc->m_parent, [=, this]() { m_doc->executeScript(cExpr); }); ++ QObject::connect(timer, &QTimer::timeout, this, [=, this]() { m_doc->executeScript(cExpr); }); + + timer->start(nMilliseconds); + +@@ -298,10 +295,10 @@ + void JSApp::clearInterval(const QJSValue &oInterval) + { + const int timerId = oInterval.property(OKULAR_TIMERID).toInt(); +- QTimer *timer = g_timerCache->value(timerId); ++ QTimer *timer = m_timerCache.value(timerId); + if (timer != nullptr) { + timer->stop(); +- g_timerCache->remove(timerId); ++ m_timerCache.remove(timerId); + delete timer; + } + } +@@ -309,10 +306,10 @@ + // app.setTimeOut() + QJSValue JSApp::setTimeOut(const QString &cExpr, int nMilliseconds) + { +- QTimer *timer = new QTimer(); ++ QTimer *timer = new QTimer(this); + timer->setSingleShot(true); + +- QObject::connect(timer, &QTimer::timeout, m_doc->m_parent, [=, this]() { m_doc->executeScript(cExpr); }); ++ QObject::connect(timer, &QTimer::timeout, this, [=, this]() { m_doc->executeScript(cExpr); }); + + timer->start(nMilliseconds); + +@@ -323,11 +320,11 @@ + void JSApp::clearTimeOut(const QJSValue &oTime) + { + const int timerId = oTime.property(OKULAR_TIMERID).toInt(); +- QTimer *timer = g_timerCache->value(timerId); ++ QTimer *timer = m_timerCache.value(timerId); + + if (timer != nullptr) { + timer->stop(); +- g_timerCache->remove(timerId); ++ m_timerCache.remove(timerId); + delete timer; + } + } +@@ -387,22 +384,17 @@ + { + } + +-JSApp::~JSApp() = default; ++JSApp::~JSApp() ++{ ++ qDeleteAll(m_timerCache); ++} + + QJSValue JSApp::wrapTimer(QTimer *timer) const + { + QJSValue timerObject = qjsEngine(this)->newObject(); + timerObject.setProperty(OKULAR_TIMERID, timer->timerId()); + +- g_timerCache->insert(timer->timerId(), timer); ++ m_timerCache.insert(timer->timerId(), timer); + + return timerObject; + } +- +-void JSApp::clearCachedFields() +-{ +- if (g_timerCache) { +- qDeleteAll(g_timerCache->begin(), g_timerCache->end()); +- g_timerCache->clear(); +- } +-} +--- a/core/script/js_document.cpp ++++ b/core/script/js_document.cpp +@@ -7,6 +7,7 @@ + + #include "js_document_p.h" + ++#include + #include + + #include +@@ -83,7 +84,8 @@ + if (files) { + QList::ConstIterator it = files->begin(), itEnd = files->end(); + for (int i = 0; it != itEnd; ++it, ++i) { +- QJSValue newdata = qjsEngine(this)->newQObject(new JSData(*it)); ++ QJSValue newdata = qjsEngine(this)->newQObject(new JSData(*it, qjsEngine(this))); ++ QJSEngine::setObjectOwnership(newdata.toQObject(), QJSEngine::CppOwnership); + dataObjects.setProperty(i, newdata); + } + } +@@ -159,7 +161,7 @@ + const QList pageFields = (*pIt)->formFields(); + for (FormField *form : pageFields) { + if (form->fullyQualifiedName() == cName) { +- return JSField::wrapField(qjsEngine(this), form, *pIt); ++ return JSField::wrapField(qjsEngine(this), form, *pIt, m_fieldCache); + } + } + } +@@ -222,7 +224,8 @@ + for (int j = 0; j < model->columnCount(); ++j) { + const QModelIndex index = model->index(i, j); + +- QJSValue item = qjsEngine(this)->newQObject(new JSOCG(model, i, j)); ++ QJSValue item = qjsEngine(this)->newQObject(new JSOCG(model, i, j, qjsEngine(this))); ++ QJSEngine::setObjectOwnership(item.toQObject(), QJSEngine::CppOwnership); + item.setProperty(QStringLiteral("name"), model->data(index, Qt::DisplayRole).toString()); + item.setProperty(QStringLiteral("initState"), model->data(index, Qt::CheckStateRole).toBool()); + +@@ -233,9 +236,10 @@ + return array; + } + +-JSDocument::JSDocument(DocumentPrivate *doc, QObject *parent) ++JSDocument::JSDocument(DocumentPrivate *doc, const std::shared_ptr &cache, QObject *parent) + : QObject(parent) + , m_doc(doc) ++ , m_fieldCache(cache) + { + } + +--- a/core/script/js_field.cpp ++++ b/core/script/js_field.cpp +@@ -23,15 +23,9 @@ + + #define OKULAR_NAME QStringLiteral("okular_name") + +-typedef QHash FormCache; +-Q_GLOBAL_STATIC(FormCache, g_fieldCache) +-typedef QHash ButtonCache; +-Q_GLOBAL_STATIC(ButtonCache, g_buttonCache) +- + // Helper for modified fields +-static void updateField(FormField *field) ++static void updateField(FormField *field, Page *page) + { +- Page *page = g_fieldCache->value(field); + if (page) { + Document *doc = PagePrivate::get(page)->m_doc->m_parent; + const int pageNumber = page->number(); +@@ -65,7 +59,7 @@ + { + m_field->setReadOnly(readonly); + +- updateField(m_field); ++ updateField(m_field, m_fieldCache->pageForField(m_field)); + } + + static QString fieldGetTypeHelper(const FormField *field) +@@ -183,16 +177,16 @@ + const QString text = value.toString(); + if (text == QStringLiteral("Yes")) { + button->setState(true); +- updateField(m_field); ++ updateField(m_field, m_fieldCache->pageForField(m_field)); + } else if (text == QStringLiteral("Off")) { + button->setState(false); +- updateField(m_field); ++ updateField(m_field, m_fieldCache->pageForField(m_field)); + } + break; + } + case FormField::FormText: { + FormFieldText *textField = static_cast(m_field); +- Page *page = g_fieldCache->value(m_field); ++ Page *page = m_fieldCache->pageForField(m_field); + if (page) { + Document *doc = PagePrivate::get(page)->m_doc->m_parent; + const QString text = value.toString(); +@@ -209,7 +203,7 @@ + FormFieldChoice *choice = static_cast(m_field); + if (choice->choiceType() == FormFieldChoice::ComboBox) { + const QString text = value.toString(); +- Page *page = g_fieldCache->value(m_field); ++ Page *page = m_fieldCache->pageForField(m_field); + if (page) { + Document *doc = PagePrivate::get(page)->m_doc->m_parent; + const int idx = choice->choices().indexOf(text); +@@ -251,7 +245,7 @@ + { + m_field->setVisible(!hidden); + +- updateField(m_field); ++ updateField(m_field, m_fieldCache->pageForField(m_field)); + } + + // Field.display (getter) +@@ -285,7 +279,7 @@ + m_field->setPrintable(true); + break; + } +- updateField(m_field); ++ updateField(m_field, m_fieldCache->pageForField(m_field)); + } + + QJSValue JSField::numItems() const +@@ -336,7 +330,7 @@ + } + const QList choiceList = tempChoiceList; + choice->setCurrentChoices(choiceList); +- updateField(choice); ++ updateField(choice, m_fieldCache->pageForField(choice)); + } + } + +@@ -345,7 +339,7 @@ + { + QJSValue fieldObject = qjsEngine(this)->newObject(); + fieldObject.setProperty(OKULAR_NAME, m_field->fullyQualifiedName()); +- g_buttonCache->insert(m_field->fullyQualifiedName(), m_field); ++ m_fieldCache->insertButton(m_field->fullyQualifiedName(), m_field); + + return fieldObject; + } +@@ -359,43 +353,34 @@ + + if (m_field->type() == Okular::FormField::FormButton) { + FormFieldButton *button = static_cast(m_field); +- const auto formField = g_buttonCache->value(fieldName); ++ const auto formField = m_fieldCache->buttonForName(fieldName); + if (formField) { + button->setIcon(formField); + } + } + +- updateField(m_field); ++ updateField(m_field, m_fieldCache->pageForField(m_field)); + } + +-JSField::JSField(FormField *field, QObject *parent) ++JSField::JSField(FormField *field, const std::shared_ptr &fieldCache, QObject *parent) + : QObject(parent) + , m_field(field) ++ , m_fieldCache(fieldCache) + { + } + + JSField::~JSField() = default; + +-QJSValue JSField::wrapField(QJSEngine *engine, FormField *field, Page *page) ++QJSValue JSField::wrapField(QJSEngine *engine, FormField *field, Page *page, const std::shared_ptr &fieldCache) + { + // ### cache unique wrapper +- QJSValue f = engine->newQObject(new JSField(field)); ++ QJSValue f = engine->newQObject(new JSField(field, fieldCache, engine)); ++ QJSEngine::setObjectOwnership(f.toQObject(), QJSEngine::CppOwnership); + f.setProperty(QStringLiteral("page"), page->number()); +- g_fieldCache->insert(field, page); ++ fieldCache->insertForm(field, page); + return f; + } + +-void JSField::clearCachedFields() +-{ +- if (g_fieldCache.exists()) { +- g_fieldCache->clear(); +- } +- +- if (g_buttonCache.exists()) { +- g_buttonCache->clear(); +- } +-} +- + QJSValue JSField::getItemAt(int nIdx, bool bExportValue) + { + QJSValue result(QJSValue::UndefinedValue); +@@ -416,4 +401,4 @@ + } + } + return result; +-} +\ No newline at end of file ++} +--- a/core/script/js_document_p.h ++++ b/core/script/js_document_p.h +@@ -14,6 +14,7 @@ + namespace Okular + { + class DocumentPrivate; ++class JSFieldCache; + + class JSDocument : public QObject + { +@@ -39,7 +40,7 @@ + Q_PROPERTY(QString subject READ subject CONSTANT) + + public: +- explicit JSDocument(DocumentPrivate *doc, QObject *parent = nullptr); ++ explicit JSDocument(DocumentPrivate *doc, const std::shared_ptr &fieldCache, QObject *parent = nullptr); + ~JSDocument() override; + + int numPages() const; +@@ -72,6 +73,7 @@ + + private: + DocumentPrivate *m_doc = nullptr; ++ std::shared_ptr m_fieldCache; + }; + + } +--- a/core/script/js_field_p.h ++++ b/core/script/js_field_p.h +@@ -8,6 +8,7 @@ + #ifndef OKULAR_SCRIPT_JS_FIELD_P_H + #define OKULAR_SCRIPT_JS_FIELD_P_H + ++#include + #include + #include + +@@ -16,6 +17,31 @@ + class FormField; + class Page; + ++class JSFieldCache ++{ ++public: ++ void insertForm(FormField *field, Page *page) ++ { ++ formCache.insert(field, page); ++ } ++ Page *pageForField(FormField *field) ++ { ++ return formCache.value(field, nullptr); ++ } ++ void insertButton(const QString &id, FormField *button) ++ { ++ buttonCache.insert(id, button); ++ } ++ FormField *buttonForName(const QString &id) ++ { ++ return buttonCache.value(id, nullptr); ++ } ++ ++private: ++ QHash formCache; ++ QHash buttonCache; ++}; ++ + class JSField : public QObject + { + Q_OBJECT +@@ -31,10 +57,10 @@ + Q_PROPERTY(QJSValue currentValueIndices READ currentValueIndices WRITE setCurrentValueIndices) // clazy:exclude=qproperty-without-notify + + public: +- explicit JSField(FormField *field, QObject *parent = nullptr); ++ explicit JSField(FormField *field, const std::shared_ptr &fieldCache, QObject *parent = nullptr); + ~JSField() override; + +- static QJSValue wrapField(QJSEngine *engine, FormField *field, Page *page); ++ static QJSValue wrapField(QJSEngine *engine, FormField *field, Page *page, const std::shared_ptr &fieldCache); + static void clearCachedFields(); + + QJSValue doc() const; +@@ -61,6 +87,7 @@ + QJSValue fieldGetValueCore(bool asString) const; + + FormField *m_field = nullptr; ++ std::shared_ptr m_fieldCache; + }; + + } +--- a/core/script/js_app_p.h ++++ b/core/script/js_app_p.h +@@ -8,6 +8,7 @@ + #ifndef OKULAR_SCRIPT_JS_APP_P_H + #define OKULAR_SCRIPT_JS_APP_P_H + ++#include + #include + #include + #include +@@ -36,7 +37,6 @@ + public: + explicit JSApp(DocumentPrivate *doc, QTimer *watchdogTimer, QObject *parent = nullptr); + ~JSApp() override; +- static void clearCachedFields(); + + int formsVersion() const; + QString language() const; +@@ -67,6 +67,7 @@ + + DocumentPrivate *m_doc = nullptr; + QTimer *m_watchdogTimer = nullptr; ++ mutable QHash m_timerCache; + }; + + } diff -Nru okular-25.04.2/debian/patches/series okular-25.04.2/debian/patches/series --- okular-25.04.2/debian/patches/series 2026-06-08 11:52:53.000000000 +0000 +++ okular-25.04.2/debian/patches/series 2026-11-29 03:49:00.000000000 +0000 @@ -1 +1,2 @@ fax-security.patch +CVE-2026-124454.patch