summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems.rb10
-rw-r--r--lib/rubygems/indexer.rb3
-rw-r--r--lib/rubygems/safe_marshal.rb71
-rw-r--r--lib/rubygems/safe_marshal/elements.rb138
-rw-r--r--lib/rubygems/safe_marshal/reader.rb182
-rw-r--r--lib/rubygems/safe_marshal/visitors/to_ruby.rb266
-rw-r--r--lib/rubygems/safe_marshal/visitors/visitor.rb74
-rw-r--r--lib/rubygems/source.rb9
-rw-r--r--lib/rubygems/specification.rb3
9 files changed, 751 insertions, 5 deletions
@@ -604,6 +604,16 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
@yaml_loaded = true
end
##
# The file name and line number of the caller of the caller of this method.
#
@@ -411,7 +411,8 @@ class Gem::Indexer
# +dest+. For a latest index, does not ensure the new file is minimal.
def update_specs_index(index, source, dest)
- specs_index = Marshal.load Gem.read_binary(source)
index.each do |spec|
platform = spec.original_platform
@@ -0,0 +1,71 @@
@@ -0,0 +1,138 @@
@@ -0,0 +1,182 @@
@@ -0,0 +1,266 @@
@@ -0,0 +1,74 @@
@@ -135,8 +135,9 @@ class Gem::Source
if File.exist? local_spec
spec = Gem.read_binary local_spec
spec = begin
- Marshal.load(spec)
rescue StandardError
nil
end
@@ -157,8 +158,9 @@ class Gem::Source
end
end
# TODO: Investigate setting Gem::Specification#loaded_from to a URI
- Marshal.load spec
end
##
@@ -188,8 +190,9 @@ class Gem::Source
spec_dump = fetcher.cache_update_path spec_path, local_file, update_cache?
begin
- Gem::NameTuple.from_list Marshal.load(spec_dump)
rescue ArgumentError
if update_cache? && !retried
FileUtils.rm local_file
@@ -1300,12 +1300,13 @@ class Gem::Specification < Gem::BasicSpecification
def self._load(str)
Gem.load_yaml
yaml_set = false
retry_count = 0
array = begin
- Marshal.load str
rescue ArgumentError => e
# Avoid an infinite retry loop when the argument error has nothing to do
# with the classes not being defined.