Commit 75a3ef18bce817bd3fc06ad93117776f03ff390d

Authored by m-holger
Committed by GitHub
2 parents faab5274 87e4c7bd

Merge pull request #1621 from m-holger/i1620

Fix field traversal in `AcroForm::transformAnnotations`: replace iter…
libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -955,8 +955,8 @@ AcroForm::transformAnnotations( @@ -955,8 +955,8 @@ AcroForm::transformAnnotations(
955 auto traverse_field = [&](QPDFObjectHandle& top_field) -> void { 955 auto traverse_field = [&](QPDFObjectHandle& top_field) -> void {
956 std::deque<Dictionary> queue({top_field}); 956 std::deque<Dictionary> queue({top_field});
957 QPDFObjGen::set seen; 957 QPDFObjGen::set seen;
958 - for (auto it = queue.begin(); it != queue.end(); ++it) {  
959 - auto& obj = *it; 958 + for (; !queue.empty(); queue.pop_front()) {
  959 + auto& obj = queue.front();
960 if (seen.add(obj)) { 960 if (seen.add(obj)) {
961 Dictionary parent = obj["/Parent"]; 961 Dictionary parent = obj["/Parent"];
962 if (parent.indirect()) { 962 if (parent.indirect()) {