@@ -39,8 +39,8 @@ module Bundler
3939 environment_preserver . replace_with_backup
4040 SUDO_MUTEX = Thread ::Mutex . new
4141
42- SAFE_MARSHAL_CLASSES = [ Symbol , TrueClass , String , Array , Hash ] . freeze
43- SAFE_MARSHAL_ERROR = "Unexpected class %s present in marshaled data. Only %s are allowed." . freeze
42+ SAFE_MARSHAL_CLASSES = [ Symbol , TrueClass , String , Array , Hash , Gem :: Version , Gem :: Specification ] . freeze
43+ SAFE_MARSHAL_ERROR = "Unexpected class %s present in marshaled data. Only %s are allowed."
4444 SAFE_MARSHAL_PROC = proc do |object |
4545 object . tap do
4646 unless SAFE_MARSHAL_CLASSES . include? ( object . class )
@@ -85,6 +85,7 @@ module Bundler
8585 autoload :StubSpecification , File . expand_path ( "bundler/stub_specification" , __dir__ )
8686 autoload :UI , File . expand_path ( "bundler/ui" , __dir__ )
8787 autoload :URICredentialsFilter , File . expand_path ( "bundler/uri_credentials_filter" , __dir__ )
88+ autoload :URINormalizer , File . expand_path ( "bundler/uri_normalizer" , __dir__ )
8889
8990 class << self
9091 def configure
@@ -506,7 +507,7 @@ def which(executable)
506507 if File . file? ( executable ) && File . executable? ( executable )
507508 executable
508509 elsif paths = ENV [ "PATH" ]
509- quote = '"' . freeze
510+ quote = '"'
510511 paths . split ( File ::PATH_SEPARATOR ) . find do |path |
511512 path = path [ 1 ..-2 ] if path . start_with? ( quote ) && path . end_with? ( quote )
512513 executable_path = File . expand_path ( executable , path )
@@ -525,12 +526,6 @@ def safe_load_marshal(data)
525526 load_marshal ( data , :marshal_proc => SAFE_MARSHAL_PROC )
526527 end
527528
528- def load_marshal ( data , marshal_proc : nil )
529- Marshal . load ( data , marshal_proc )
530- rescue TypeError => e
531- raise MarshalError , "#{ e . class } : #{ e . message } "
532- end
533-
534529 def load_gemspec ( file , validate = false )
535530 @gemspec_cache ||= { }
536531 key = File . expand_path ( file )
@@ -619,6 +614,12 @@ def self_manager
619614
620615 private
621616
617+ def load_marshal ( data , marshal_proc : nil )
618+ Marshal . load ( data , marshal_proc )
619+ rescue TypeError => e
620+ raise MarshalError , "#{ e . class } : #{ e . message } "
621+ end
622+
622623 def eval_yaml_gemspec ( path , contents )
623624 Kernel . require "psych"
624625
0 commit comments