From 87e4c7bd8e4d8a8d19c2571068cdfba01f54c2dd Mon Sep 17 00:00:00 2001 From: m-holger Date: Fri, 5 Dec 2025 15:54:23 +0000 Subject: [PATCH] Fix field traversal in `AcroForm::transformAnnotations`: replace iterator with `front`/`pop_front` --- libqpdf/QPDFAcroFormDocumentHelper.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index c463b91..8eb496a 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -955,8 +955,8 @@ AcroForm::transformAnnotations( auto traverse_field = [&](QPDFObjectHandle& top_field) -> void { std::deque queue({top_field}); QPDFObjGen::set seen; - for (auto it = queue.begin(); it != queue.end(); ++it) { - auto& obj = *it; + for (; !queue.empty(); queue.pop_front()) { + auto& obj = queue.front(); if (seen.add(obj)) { Dictionary parent = obj["/Parent"]; if (parent.indirect()) { -- libgit2 0.21.4