DescriptionAvoid dereferencing find() without checking for == end()
If (due to an unexpected failure) one of the find() calls in
audio_video_metadata_extractor_unittest.cc fails (returns end()) then
dereferencing it triggers undefined behavior. This makes the results of
the test undefined. In most cases the test failure will still be caught
but there are no guarantees.
This change adds a helper function to simplify using find() in a way
that is safe even in the face of unexpected failures.
This was discovered while investigating crbug.com/581768.
R=dalecurtis@chromium.org
Committed: https://crrev.com/a7a346e3e460cd7273a1346f01e8c260b518a5c6
Cr-Commit-Position: refs/heads/master@{#372219}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Completed fix, and CR nit fixes #Messages
Total messages: 9 (3 generated)
|