From 9aedd79729193d57939dd171850eb2d44d28eecb Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Thu, 1 Jan 2015 14:59:00 -0800
Subject: [PATCH 1/3] 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.
---
 src/grep.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/grep.c b/src/grep.c
index 2276e93..c85fc6e 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;
 }

-- 
2.2.1

