Skip to content

Now allocates properly sized result buffer. - #3657

Merged
ezyang merged 1 commit into
haskell:masterfrom
NovaDenizen:master
Aug 1, 2016
Merged

ezyang merged 1 commit into
haskell:masterfrom
NovaDenizen:master

Conversation

@NovaDenizen

Copy link
Copy Markdown
Contributor

See #3649

@mention-bot

Copy link
Copy Markdown

@NovaDenizen, thanks for your PR! By analyzing the annotation information on this pull request, we identified @23Skidoo and @phadej to be potential reviewers

@ezyang

ezyang commented Aug 1, 2016

Copy link
Copy Markdown
Contributor

Thanks! I'll wait for Appveyor tests to go green and then I'll merge it.

(I checked to make sure we weren't committing an off-by-one-error. The docs are very confusing in this respect but I believe the code is right: querying for the needed buffer size will return enough space for the null byte, even though the success return does NOT include the null byte. Pshaw!)

@ezyang

ezyang commented Aug 1, 2016

Copy link
Copy Markdown
Contributor

@NovaDenizen I just realized that this code could have been made more robust in one slight way: we should check the return value of the second invocation and error if it is greater than the buffer size we passed in (this would have also caught the previous problem, instead of passing a half-constructed buffer back to the user.) Now that the code is right, I guess it's unnecessary though!

@ezyang
ezyang merged commit 5a1f7d5 into haskell:master Aug 1, 2016
@23Skidoo

23Skidoo commented Aug 1, 2016

Copy link
Copy Markdown
Member

LGTM. Thanks, @NovaDenizen!

@23Skidoo

23Skidoo commented Aug 1, 2016

Copy link
Copy Markdown
Member

Also cherry-picked into 1.24.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants