Skip to content

Commit

Permalink
Convert known it != end() DCHECK failures to CHECK
Browse files Browse the repository at this point in the history
These have hit on DCHECK builds in the wild and precede erasing or
dereferencing an iterator that is UB.

This CL excludes DCHECK failures that precede non-DCHECK handling of the
it != end() failures. Those should probably be rewritten as CHECKs
but are less urgent and semi-orthogonal.

Known crashes (one per file) are:

crash/dc49e3cadab36d4c
crash/0ee3427d25937024
crash/b89303e84d123019
crash/cc35183b861a4992

Bug: 1418734
Change-Id: I81ed7b45be33769e250c65c8bb7334a34be4380e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4288168
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: Dana Fried <dfried@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1109350}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed Feb 24, 2023
1 parent dd934b5 commit 1aec0b2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/scoped_multi_source_observation.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ScopedMultiSourceObservation {
// Remove the object passed to the constructor as an observer from |source|.
void RemoveObservation(Source* source) {
auto it = base::ranges::find(sources_, source);
DCHECK(it != sources_.end());
CHECK(it != sources_.end());
sources_.erase(it);
Traits::RemoveObserver(source, observer_);
}
Expand Down
4 changes: 2 additions & 2 deletions cc/tiles/gpu_image_decode_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,8 @@ Iterator GpuImageDecodeCache::RemoveFromPersistentCache(Iterator it) {
}

auto entries_it = paint_image_entries_.find(it->second->paint_image_id);
DCHECK(entries_it != paint_image_entries_.end());
DCHECK_GT(entries_it->second.count, 0u);
CHECK(entries_it != paint_image_entries_.end());
CHECK_GT(entries_it->second.count, 0u);

// If this is the last entry for this image, remove its tracking.
--entries_it->second.count;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void AnnotationAgentImpl::ScrollIntoView() const {

EphemeralRangeInFlatTree range = attached_range_->ToEphemeralRange();

DCHECK(range.Nodes().begin() != range.Nodes().end());
CHECK(range.Nodes().begin() != range.Nodes().end());

Node& first_node = *range.Nodes().begin();

Expand Down
2 changes: 1 addition & 1 deletion ui/base/interaction/element_tracker_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void AddElement(ElementIdentifier identifier,

void ActivateElement(ElementIdentifier identifier) {
const auto it = elements_.find(identifier);
DCHECK(it != elements_.end());
CHECK(it != elements_.end());
ui::ElementTracker::GetFrameworkDelegate()->NotifyElementActivated(
it->second.get());
}
Expand Down

0 comments on commit 1aec0b2

Please sign in to comment.