Limit Date.parse input length and make interruptible#6952
Merged
enebo merged 5 commits intojruby:jruby-9.3from Nov 30, 2021
Merged
Limit Date.parse input length and make interruptible#6952enebo merged 5 commits intojruby:jruby-9.3from
enebo merged 5 commits intojruby:jruby-9.3from
Conversation
This prevents extremely long input from tying up the system for a long time.
This test passes to DateTime.parse a keyword argument "create_additions" that is unknown to DateTime, but because CRuby only checks for the "limit" option it expects, this does not cause any error. In JRuby, where we still have this code in Ruby, the unknown keyword is explicitly rejected. We exclude this for now and will fix the bad test in json lib.
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.
Excessively long input to the various Date parsing methods can cause the calling thread to run for a long time, perhaps tying it up indefinitely. This PR incorporates to changes similar to those in ruby/date@3959acc.
regexp.interruptible=falsein .jruby_opts, with-Xregexp.interruptible=falseon the command line, or by setting the JVM propertyjruby.regexp.interruptible=falseThis patch differs from #6951 in that it enables interruptible Regexp matches globally, since this appears to now be the case in CRuby. This also simplifies the PR and avoids modifying the Java code.
The pure-Ruby workaround from #6951 applies here, and manually enabling the
regexp.interruptibleproperty would bring a patched 9.3.1 or 9.3.0 install up to compliance with the test added here. No rebuild of JRuby is needed in this case.cc @jordansissel, @rsim