Sophie

Sophie

distrib > Fedora > 18 > i386 > by-pkgid > 277616b07cbd86ec7d58c820c1f5679d > files > 1

rubygems-1.8.25-8.fc18.src.rpm

require 'benchmark'
require 'rubygems'

valid = Benchmark.measure do
  Gem::Version.new '1.22.333.4444.55555.666666.7777777'
end

puts 'Valid version time:'
puts valid

invalid = Benchmark.measure do
  begin
    Gem::Version.new '1.22.333.4444.55555.666666.7777777.'
  rescue
  end
end

puts 'Invalid version time:'
puts invalid

n = (valid.real - invalid.real).abs

if 0.1 < n then
  puts 'You are vulnerable to CVE-2013-4287.'
  exit(1)
else
  puts 'You are NOT vulnerable to CVE-2013-4287.'
end