grep segfaults when you ask for context
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.