Project

General

Profile

Bug #9552

Updated by Andrew Stormont over 3 years ago

You can specify the number of surrounding lines that should also be printed out for each match (with -B NUM, -C NUM or just -NUM) as context, but if you do grep with core dump.    This is because the check that tests whether the buffer needs to grow is faulty.    Due to missing parenthesis it causes the buffer to balloon prematurely and then later not grow when the buffer is no longer big enough, causing a buffer overflow.    It's also possible that after growing it still won't be big enough so we need to do the check in a loop.

Back