diff options
author | Elliott Hughes <enh@google.com> | 2019-07-16 14:50:41 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-07-16 23:10:54 -0500 |
commit | fdd58dc338b5d1797bb7f44f2602ed60b1c7b911 (patch) | |
tree | 3344059ce510d11bb919ce4b107f1dce74291a6d /tests/grep.test | |
parent | a61cb72deaefe4e6d6ac97a3776ea3c58502766d (diff) | |
download | toybox-fdd58dc338b5d1797bb7f44f2602ed60b1c7b911.tar.gz |
grep: fix two bugs found by hwasan.
The first bug appeared as a memory overwrite, but was actually visible
without hwasan: basically any `grep -F` that let to multiple matches on
the same line was broken.
The second bug was another memory overwrite, visible when I ran the
existing grep tests.
Bug: http://b/137573082
Diffstat (limited to 'tests/grep.test')
-rwxr-xr-x | tests/grep.test | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/grep.test b/tests/grep.test index 68c8dd85..76f406c8 100755 --- a/tests/grep.test +++ b/tests/grep.test @@ -184,3 +184,16 @@ ln -s ../dir sub/link testing "" "grep -rh hello sub" "" "" "" testing "" "grep -Rh hello sub" "hello\n" "" "" rm -rf sub real + +# -F multiple matches +testing "-F multiple" "grep -F h input" "this is hello\nthis is world\n" \ + "missing\nthis is hello\nthis is world\nmissing" "" +testing "-Fi multiple" "grep -Fi h input" "this is HELLO\nthis is WORLD\n" \ + "missing\nthis is HELLO\nthis is WORLD\nmissing" "" +testing "-F empty multiple" "grep -Fi '' input" \ + "missing\nthis is HELLO\nthis is WORLD\nmissing\n" \ + "missing\nthis is HELLO\nthis is WORLD\nmissing" "" +testing "-Fx" "grep -Fx h input" "h\n" \ + "missing\nH\nthis is hello\nthis is world\nh\nmissing" "" +testing "-Fix" "grep -Fix h input" "H\nh\n" \ + "missing\nH\nthis is HELLO\nthis is WORLD\nh\nmissing" "" |