summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2022-12-17 01:54:46 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-12-20 13:15:02 +0900
commitefd103f3e58fcf3aeb6c4a0d3dd9233448698231 (patch)
tree7aaf50c5b7c7742f9777a8b1dbf6f18bfe9341cf
parent1db9bcfeaf27b8a8ced1ea5ad13f5c5774530a6b (diff)
[rubygems/rubygems] Fix crash when showing some resolution errors
If the conflict explanation includes empty ranges and version unions, Pub Grub was crashing. https://github.com/rubygems/rubygems/commit/eb360b77a2
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6966
-rw-r--r--lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb b/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb
index b66c603dfd..c898a6522d 100644
--- a/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb
+++ b/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb
@@ -77,7 +77,7 @@ module Bundler::PubGrub
return true
end
- if !my_range.max || (other_range.max && other_range.max < my_range.max)
+ if !my_range.max || other_range.empty? || (other_range.max && other_range.max < my_range.max)
other_range = other_ranges.shift
else
my_range = my_ranges.shift
@@ -119,7 +119,7 @@ module Bundler::PubGrub
while my_range && other_range
new_ranges << my_range.intersect(other_range)
- if !my_range.max || (other_range.max && other_range.max < my_range.max)
+ if !my_range.max || other_range.empty? || (other_range.max && other_range.max < my_range.max)
other_range = other_ranges.shift
else
my_range = my_ranges.shift