Linode reported an alarm for 2hr 100% CPU on our server. R-scape was hung on a user input. Traced the problem, and it's that the input ends in a \r carriage return with no newline. esl_buffer sees this as an incomplete newline (i.e. possibly a Windows \r\n) and mishandles it, trying to load more data to check for the expected \n. Any input (file, stream) that ends in \r will cause esl_buffer-based reads to hang.
The incorrect code is in esl_buffer.c::buffer_countline(), in the first do loop, currently lines 1755..1761.
Linode reported an alarm for 2hr 100% CPU on our server. R-scape was hung on a user input. Traced the problem, and it's that the input ends in a
\r
carriage return with no newline.esl_buffer
sees this as an incomplete newline (i.e. possibly a Windows\r\n
) and mishandles it, trying to load more data to check for the expected \n. Any input (file, stream) that ends in\r
will causeesl_buffer
-based reads to hang.The incorrect code is in
esl_buffer.c::buffer_countline()
, in the firstdo
loop, currently lines 1755..1761.