[asan] Attempt to fix tests broken by #94307. #95340
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change #94307 attempted to make the checks in several tests more flexible, but in one case it introduced a bug which broke one test, and in two other cases, caused a passing test to now fail. I am repeating my analysis here, but I originally made these comments on #94307. Since this is failing on our internal builder and at least one upstream build bot, I am attempting to fix this change in order to unblock us and get the bot back to green.
strdup_oob_test.cpp:
This test had
#{{[01]}}
replaced with#{{[0-9]}}+
in order to have it match more than just#0
or#1
. The problem was the+
for the regex was mistakenly placed outside of the regex expression, causing it to only match the literal strings#0+
,#1+
,#2+
, etc. This fixes the issue by putting the+
character back in the regex where it was likely intended to be.strcpy-overlap.cpp and use-after-free-right.cpp:
These cases both failed on our internal builder for similar reasons. For strcpy-overlap.cpp, the CHECK line was changed from
{{#0 0x.* in .*strcpy}}
to{{#[0-9]+ 0x.* in .*strcpy .*.cpp}}
. This caused our builder to fail because the line that was previously being matched looked like this:Instead of just
strcpy
, we havestrcpy.part.0
. Since there isn't a space immediately following thestrcpy
text, the matching failed causing the test to fail.The test use-after-free-right.cpp had a similar failure. The regex was changed from
{{ #0 0x.* in .*free}}
to{{ #[0-9]+ 0x.* in .*free .*.cpp}}
. In this case, our builder was generating the following output that previously matched, but no longer did after this change due to no space immediately following thefree
text:The fix for both of these tests is to change the regex to accept zero or more characters after
strcpy
andfree
respectively so that they match both cases.