Project

General

Profile

Actions

Bug #9552

closed

grep segfaults when you ask for context

Added by Andrew Stormont over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2018-05-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

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.


Related issues

Related to illumos gate - Bug #8858: /usr/bin/grep doesn't support -E optionClosed2017-11-23

Actions
Actions

Also available in: Atom PDF