Boost Testing :
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-07-06 23:20:01
Martyn Lovell wrote:
>> The original rationale for deprecating memcpy makes sense, but I
>> don't see
>> any connection to sgetn. Memcpy takes two buffers, sgetn just one.
>> basic_streambuf::sgetn, like, basic_istream::read, is exactly
>> analogous to
>> fread from stdio.h, which AFAICT has not been deprecated.
> Sgetn/bi::read have two different kinds of things to deal with -
> items read from the stream, and items written to the output buffers.
Thanks for your reply, but I still don't get it.
It's true that if you're implementing xsgetn you have two tasks: (i) extract n
characters from the underlying source, and (ii) copy them to the user-provided
buffer. Are those the two things you're talking about? How does this lead to
security problems that could be solved by specifying an extra buffer size
parameter? Could you give an example synopsis, and explain what the various
parameters would mean?
> Not exactly the same as memcpy, but related. We actually did consider
> doing the same to fread, but this change never made it into one of
> the shipping betas.
>> Would you mind giving a quick description of how to mark an iterator
>> as checked, or posting a url?
> This doc describes use of the checked iterators we have defined:
> Are you looking to take your existing iterators and mark them as
No -- I just wanted to know what to do if the need ever arose.
> Martyn Lovell