Re-use ruby strings - #2
Merged
Merged
Conversation
mislav
added a commit
that referenced
this pull request
Feb 18, 2015
Handle integer overflow by treating number component as string if too large
kivikakk
pushed a commit
that referenced
this pull request
Feb 7, 2018
fca9ae5 "avoid signed overflow" can still cause undefined behavior because `compare_version_number` can return `INT_MIN` which `version_compare_cb_r` then tries to negate: ``` ../../../../ext/version_sorter/version_sorter.c:94:9: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself #0 0x7f9cde1fe1ba in version_compare_cb_r /tmp/x86_64-linux-gnu/version_sorter/2.3.1/../../../../ext/version_sorter/version_sorter.c:94:9 #1 0x7f9cde75c231 (/lib/x86_64-linux-gnu/libc.so.6+0x39231) #2 0x7f9cde75c69e in qsort_r (/lib/x86_64-linux-gnu/libc.so.6+0x3969e) #3 0x7f9cde1fd68c in rb_version_sort_1 /tmp/x86_64-linux-gnu/version_sorter/2.3.1/../../../../ext/version_sorter/version_sorter.c:202:2 ```
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.
Avoids creating new ruby strings when returning a sorted array. This fixes an issue in 1.9 where a version string loses its encoding (and gets truncated if it has a null byte in it) when being sorted.
/cc @github/c-hackers @vmg @scottjg