I did use memchr in my fix - will check/see if your other changes make a 
difference.

----- Original Message -----
From: "Maximiliano Curia" <m...@debian.org>
To: 203...@bugs.debian.org, 203115-submit...@bugs.debian.org, 
cont...@bugs.debian.org
Sent: Tuesday, December 13, 2011 12:52:16 PM
Subject: Bug#203115: Block buffering patch

tag 203115 +patch
thanks

Hi,

I could reproduce this bug, the problem shows up when the input includes NUL
chars, as the functions used by mawk are expecting C strings. Which ends up in
a malloc read loop till EOF is reached, on EOF mawk would process only one
of the read lines. If the file is large enough (or data is being read from a
infinite device such as /dev/urandom) the OOM killer would do its job.

Replacing the call to strchr with memchr fixes part of the issues, the rest of
the patch deals with the buffer to avoid dropping what was read.
In the patch there's also a small test for this issues.

This patch fixes only the block buffering part (reading from a file), reading
from stdin is made with fgets which would fail if the input include a NUL
char.

Thanks,
-- 
"The sooner you start to code, the longer the program will take." -- Roy Carlson
Saludos /\/\ /\ >< `/



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to