Properly update iterator

Bug: 325296797
Change-Id: I39f76519c46804ad663172abf91ef582bde135e7
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/5310754
Commit-Queue: Joshua Peraza <jperaza@chromium.org>
Reviewed-by: Justin Cohen <justincohen@chromium.org>
This commit is contained in:
Joshua Peraza 2024-02-20 18:50:05 -08:00 committed by Crashpad LUCI CQ
parent 29ac83caeb
commit 37afd37401

View File

@ -99,9 +99,11 @@ ModuleSnapshotSanitized::AnnotationsSimpleMap() const {
std::map<std::string, std::string> annotations = std::map<std::string, std::string> annotations =
snapshot_->AnnotationsSimpleMap(); snapshot_->AnnotationsSimpleMap();
if (allowed_annotations_) { if (allowed_annotations_) {
for (auto kv = annotations.begin(); kv != annotations.end(); ++kv) { for (auto kv = annotations.begin(); kv != annotations.end();) {
if (!KeyIsAllowed(kv->first, *allowed_annotations_)) { if (KeyIsAllowed(kv->first, *allowed_annotations_)) {
annotations.erase(kv); ++kv;
} else {
kv = annotations.erase(kv);
} }
} }
} }