develooper Front page | perl.perl5.porters | Postings from April 2014

[perl #116925] document/publicize THINKFIRST

Thread Next
From:
Tony Cook via RT
Date:
April 21, 2014 02:04
Subject:
[perl #116925] document/publicize THINKFIRST
Message ID:
rt-4.0.18-29296-1398045868-1908.116925-15-0@perl.org
On Wed Apr 16 18:51:10 2014, tonyc wrote:
> 1) offset <= SvCUR() - if the wrapped function does read needlen
> bytes, some of the data is going to be uninitialized.
> 
> 2) offset > SvCUR() - the wrapped function is going to receive
> uninitialized content, but the caller is also going to receiver
> uninitialized data.

I went through some drafts trying to address this, but I think examples like
this need to stay simple rather than trying to cover every possible use of
the APIs.

So all I've added is a check that offset <= len so we don't return undefined content back to the caller.

I don't think it's necessary to document here that the extra memory allocated by SvGROW() is undefined, since we don't say what it is initialized it, the caller shouldn't be making an assumptions about it.

Tony

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=116925

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About