summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2015-01-01 14:59:00 -0800
committerJim Meyering <meyering@fb.com>2015-01-08 13:41:37 -0800
commit9aedd79729193d57939dd171850eb2d44d28eecb (patch)
tree0094f05544bdaea5d13d5018c898768b681c5597 /src
parentc2d0489c43264b25f063058c4c34a66e2445abae (diff)
downloadgrep-9aedd79729193d57939dd171850eb2d44d28eecb.tar.gz
grep: avoid false-positive UMR
For some inputs, valgrind would report an uninitialized memory read error, but it was harmless. * src/grep.c (fillbuf): Initialize those trailing bytes.
Diffstat (limited to 'src')
-rw-r--r--src/grep.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/grep.c b/src/grep.c
index 2276e93a..c85fc6e4 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -810,6 +810,12 @@ fillbuf (size_t save, struct stat const *st)
fillsize = undossify_input (readbuf, fillsize);
buflim = readbuf + fillsize;
+
+ /* Initialize the following word, because skip_easy_bytes and some
+ matchers read (but do not use) those bytes. This avoids false
+ positive reports of these bytes being used uninitialized. */
+ memset (buflim, 0, sizeof (uword));
+
return cc;
}