Subject: bug#29032: grep 3.x: 2.4MB big file causes 'Value too large for defined data type'

From: Uwe Sauter <[email-masked]>
Date: Fri, 27 Oct 2017 23:32:38 +0200

Hi,

I have several small files where grep'ing for a static string results in 'Value too large for defined data type'.

E.g.

$ grep 123456 2fort.bsp
grep: 2fort.bsp: Value too large for defined data type

But grep'ing for a shorter search string succeeds:

$ grep 123 2fort.bsp
grep: 2fort.bsp matches

2fort.bsp has size 2488684 bytes.

This happens on an up-to date Gentoo with kernel 4.12.12 and glibc 2.23. Installed grep is version 3.0.

Linux kiste 4.12.12-gentoo #1 SMP Tue Sep 19 20:07:27 CEST 2017 x86_64 Intel(R) Xeon(R) CPU E3-1245 v3 @ 3.40GHz
GenuineIntel GNU/Linux

For debugging I downloaded both 3.0 and 3.1 and compiled with

$ CFLAGS="${CFLAGS} -ggdb" CPPFLAGS="${CPPFLAGS} -ggdb" ./configure --enable-gcc-warnings
$ make

Both versions show the same failure.

I'd like to help debugging but don't know where I should start looking in the source code. Any hint is appreciated.

I also prepared a strace output for grep 3.1 (attached).

Regards,

	Uwe