[Patch] _M_out_lim vs setp

Paolo Carlini pcarlini@unitus.it
Wed Apr 16 21:23:00 GMT 2003


Hi all, hi Benjamin,

I'm currently working on removing some unnecessary checks
for NULL pointers and noticed this bit which seems not ok
from a correctness point of view.

Basing on the semantics of _M_out_lim seems obvious that,
upon setp() it should be equal to _M_out_beg. Then at each
put operation it will move forward, toward _M_out_end.

Consider, for instance, the effect of the _M_really_overflow
call present in close(): if we didn't do any put operation
we are not supposed to write out anything. However, since the
former flushes all the chars between _M_out_beg and _M_out_lim,
for a setp put area we end up writing garbage.

Thus the patch below, tested x86-linux. Ok?

Paolo.

/////////




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030416/19183a60/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20030416/19183a60/attachment-0001.ksh>


More information about the Libstdc++ mailing list