Patch to guard against integer overflow#19
Closed
ingydotnet wants to merge 1 commit into
Closed
Conversation
51296df to
b753d06
Compare
| YAML_DECLARE(int) | ||
| yaml_stack_extend(void **start, void **top, void **end) | ||
| { | ||
| void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2); |
Contributor
There was a problem hiding this comment.
Are we sticking to C89? What are our supported operating systems if we're deciding to stick to that?
| void *new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2); | ||
| void *new_start; | ||
|
|
||
| if ((char *)*end - (char *)*start >= INT_MAX / 2) |
Contributor
There was a problem hiding this comment.
Is there a reason not to calculate
(char *)*end - (char *)*startOnce and use it here and below? I know it shouldn't change very much, but I feel like it'll be cleaner, especially if we give it a very clear name.
b753d06 to
12bb0c8
Compare
Member
Author
|
This was originally from Florian Weimer fweimer@redhat.com circa Feb 2014. Would be good to add a test. Might want to find/ask Florian. |
Contributor
|
Going to close and reopen this to trigger AppVeyor |
sigmavirus24
pushed a commit
to sigmavirus24/libyaml
that referenced
this pull request
Apr 6, 2017
Initial work for yaml#19.
sigmavirus24
pushed a commit
to sigmavirus24/libyaml
that referenced
this pull request
Apr 6, 2017
It is very unfortunate, but we have to copy the file. I'll think how it is possible to restructure our images to avoid duplication. Issue yaml#19
sigmavirus24
pushed a commit
to sigmavirus24/libyaml
that referenced
this pull request
Apr 6, 2017
Member
Author
|
@dtolnay thanks, closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Originally from Ruby binding.