Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tre-agrep can print garbage instead of delimiter #42

Open
ghost opened this issue Mar 30, 2016 · 0 comments
Open

tre-agrep can print garbage instead of delimiter #42

ghost opened this issue Mar 30, 2016 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 30, 2016

When --delimiter (-d) is specified, and delimiter is to be printed before the matching record, tre-grep can print delim_len bytes of garbage, instead of the delimiter. This is because, just before printing the matching record, an adjustment is made to |record|, the start of the current record. delim_len is subtracted from record, it is not necessarily true that there are that many bytes in the buffer, buf, between buf and record. So, whatever bytes are just below buf get printed. My experience, so far, is that it just prints garbage, but the behavior is undefined, so it could be worse.

My test version has a test to ensure that record - buf >= delim_len.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants