cURL / Mailing Lists / curl-library / Single Mail


readwrite_data() and read_rewind()

From: Yang Tse <>
Date: Fri, 11 Dec 2009 13:51:38 +0100

Hi Daniel, et all

While playing a bit with test case #1070 I've arrived at a point in
which there is a call to read_rewind() which seems to be
inappropriate, or at least a week read_rewind() implementation.

In order to reproduce the issue, edit data/test1070 and duplicate in
place line #18 (the one that reads "you are not supposed to be allowed
[...]") one or two hundred times. With this change the test will fail,
of course, but it doesn't matter.

Now run -g 1070, set a breakpoint on transfer.c:648 and
let it run run to the breakpoint which would call read_rewind(conn,

If you step into read_rewind() you'll see that conn->read_pos is zero,
and that it is 'decreased' by an amount, resulting in a crazy
conn->read_pos value.

My question is... Do we simply prevent read_rewind() from decreasing
conn->read_pos below zero, or is there some check you think would be
necessary to add near transfer.c:635 to directly avoid the call to
read_rewind(). or whatever else.


List admin:
Received on 2009-12-11