-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Dockerfile logic into extconf.rb
This change is in preparation for building a proper gem that can be installed from RubyGems.
- Loading branch information
Showing
10 changed files
with
111 additions
and
53 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#!/bin/bash | ||
|
||
export LD_PRELOAD=${ASAN_MERGED_LIB} | ||
|
||
ruby -Ilib bin/dummy.rb "$@" | ||
LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy.ext_path')/asan_with_fuzzer.so \ | ||
ruby bin/dummy.rb "$@" |
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'pathname' | ||
|
||
# A Ruby C extension fuzzer | ||
module Ruzzy | ||
require 'cruzzy/cruzzy' | ||
require 'cruzzy/dummy/dummy' | ||
|
||
DEFAULT_ARGS = [$PROGRAM_NAME] + ARGV | ||
|
||
def fuzz(test_one_input, args = DEFAULT_ARGS) | ||
c_fuzz(test_one_input, args) | ||
end | ||
|
||
def ext_path | ||
(Pathname.new(__FILE__).parent.parent + 'ext' + 'cruzzy').to_s | ||
end | ||
|
||
def dummy_test_one_input(data) | ||
# This 'require' depends on LD_PRELOAD, so it's placed inside the function | ||
# scope. This allows us to run ext_path for LD_PRELOAD and not have a | ||
# circular dependency. | ||
require 'dummy/dummy' | ||
|
||
c_dummy_test_one_input(data) | ||
end | ||
|
||
module_function :fuzz | ||
module_function :ext_path | ||
module_function :dummy_test_one_input | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rake' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'ruzzy' | ||
s.version = '0.5.0' | ||
s.summary = 'A Ruby C extension fuzzer' | ||
s.authors = ['Trail of Bits'] | ||
s.email = '[email protected]' | ||
s.files = FileList['lib/**/*.rb', 'ext/**/*.{rb,c,h}'] | ||
s.files = Dir['lib/**/*.rb'] + Dir['ext/**/*.{rb,c,h}'] | ||
s.homepage = 'https://rubygems.org/gems/ruzzy' | ||
s.license = 'AGPL-3.0' | ||
s.extensions = %w[ext/cruzzy/extconf.rb] | ||
s.extensions = %w[ext/cruzzy/extconf.rb ext/dummy/extconf.rb] | ||
s.required_ruby_version = '>= 3.1.0' | ||
|
||
s.add_development_dependency 'rake', '~> 13.0' | ||
|
This file contains 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