fuzzr 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fuzzr might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.rdoc +28 -0
- data/bin/fuzz +7 -0
- data/fuzzers/check_ace_error.excludes +5 -0
- data/fuzzers/check_ace_error.rb +37 -0
- data/fuzzers/check_catch_ex_as_const.rb +41 -0
- data/fuzzers/check_cout_cerr.excludes +5 -0
- data/fuzzers/check_cout_cerr.rb +37 -0
- data/fuzzers/check_executablebit.rb +37 -0
- data/fuzzers/check_exit_keyword.excludes +2 -0
- data/fuzzers/check_exit_keyword.rb +37 -0
- data/fuzzers/check_fileheader.excludes +5 -0
- data/fuzzers/check_fileheader.rb +92 -0
- data/fuzzers/check_filename.excludes +8 -0
- data/fuzzers/check_filename.rb +33 -0
- data/fuzzers/check_id_tag.excludes +3 -0
- data/fuzzers/check_id_tag.rb +34 -0
- data/fuzzers/check_new_delete.excludes +6 -0
- data/fuzzers/check_new_delete.rb +37 -0
- data/fuzzers/check_printf_keyword.excludes +2 -0
- data/fuzzers/check_printf_keyword.rb +37 -0
- data/fuzzers/check_taox11_namespace.excludes +5 -0
- data/fuzzers/check_taox11_namespace.rb +38 -0
- data/lib/fuzz/console.rb +52 -0
- data/lib/fuzz/fuzz.rb +399 -0
- data/lib/fuzz/fuzzers/check_whitespace.rb +62 -0
- data/lib/fuzz/fzzr.rb +258 -0
- data/lib/fuzz/log.rb +97 -0
- data/lib/fuzz/options.rb +208 -0
- data/lib/fuzz/screen.rb +85 -0
- data/lib/fuzz/system.rb +57 -0
- data/lib/fuzz/version.rb +18 -0
- metadata +81 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 780d3277b18402a6bb47d1767040f08c084f5bff32f96ce0d96040d55f38f9db
|
4
|
+
data.tar.gz: 2f2d6875cb646ebf48d9dd2fa8c713482f1f3a9b1bf5574ea5f4cb5ba3d3800b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4299e3071f34a5117ca9606fdc5c482811c6236d56dc2c6acc30d4412adb8767720dee2be825e54ec0b1ca6442d63f3007ab16252d2232aaefd7d0a17bfb57a6
|
7
|
+
data.tar.gz: 613fbb371e0760fb400450e73f86ef3c42f3dafd7e46e4a2fec5d928ee4aab49226b207f1e8f70e066bf408ff2456f5623c036d0df7779aebdb12a4aa69947c3
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Remedy IT Expertise BV
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
{<img src="https://badge.fury.io/rb/fuzzr.svg" alt="Gem Version" />}[https://badge.fury.io/rb/fuzzr]
|
2
|
+
{<img src="https://www.codefactor.io/repository/github/remedyit/fuzzr/badge" alt="CodeFactor" />}[https://www.codefactor.io/repository/github/remedyit/fuzzr]
|
3
|
+
|
4
|
+
= fuzz
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
{fuzzr}[https://github.com/RemedyIT/fuzzr] is an open source fuzz check tool
|
9
|
+
|
10
|
+
== Bugs
|
11
|
+
|
12
|
+
If you find a bug, please report it as {fuzzr issue}[https://github.com/RemedyIT/fuzzr/issues].
|
13
|
+
|
14
|
+
== Warranty
|
15
|
+
|
16
|
+
This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.
|
17
|
+
|
18
|
+
== Installing fuzzr
|
19
|
+
|
20
|
+
fuzzr is distributed as a Ruby Gem. You can download and install fuzzr as a Ruby Gem from the common {Rubygems.org}[https://www.rubygems.org/gems/fuzzr] repository by executing the following command:
|
21
|
+
|
22
|
+
$ gem install fuzzr
|
23
|
+
|
24
|
+
The RIDL Gem is a Ruby-only Gem without any dependencies.
|
25
|
+
|
26
|
+
== Releasing new RIDL Ruby Gem
|
27
|
+
|
28
|
+
A new fuzzr ruby gem release can be made by incrementing the fuzzr version in link:lib/fuzz.rb and create a new release on {github}[https://github.com/RemedyIT/fuzzr/releases] matching the new version (for example v2.7.0). The github {Ruby Gem Release}[https://github.com/RemedyIT/ridl/actions?query=workflow%3A%22Ruby+Gem+Release%22] action will automatically create a new gem and push it to {Rubygems.org}[https://www.rubygems.org/gems/fuzzr].
|
data/bin/fuzz
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_ace_error.rb - TAOX11 ACE_ERROR checker
|
4
|
+
#
|
5
|
+
# Author: Martin Corino
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11AceErrorChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_ace_error
|
15
|
+
@description = 'checks against the use of the old ACE logging macros in test code'
|
16
|
+
@errormsg = 'detected use of ACE_ERROR, ACE_DEBUG, and/or ACE_ERROR_RETURN'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C', 'asm']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /(^|\s+)(ACE_ERROR|ACE_ERROR_RETURN|ACE_DEBUG)(\s+|$)/
|
30
|
+
lnptr.mark_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Fuzz.register_fzzr(TAOX11AceErrorChecker.new)
|
37
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_catch_ex_as_const.rb - Checks whether an exception is caught as const
|
4
|
+
#
|
5
|
+
# Author: Marcel Smit
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class ExAsConstChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_catch_ex_as_const
|
15
|
+
@description = 'checks whether an exception is caught as const'
|
16
|
+
@errormsg = 'exceptions should be caught as const'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /^\s*(catch\(|catch \()/
|
30
|
+
unless lnptr.text =~ /([...])/
|
31
|
+
if not lnptr.text =~ /const/
|
32
|
+
lnptr.mark_error
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Fuzz.register_fzzr(ExAsConstChecker.new)
|
41
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_cout_cerr.rb - TAOX11 cout/cerr in core checker
|
4
|
+
#
|
5
|
+
# Author: Marcel Smit
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11CoutCerrChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_cout_cerr
|
15
|
+
@description = 'checks against the use of cout and cerr in the CORE code (to be expanded to all code)'
|
16
|
+
@errormsg = 'detected use of cout and/or cerr'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /(^|\s+)(cout|cerr|std::cout|std::cerr|std::wcout|std::wcerr|wcout|wcerr)(\s+|$)/
|
30
|
+
lnptr.mark_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Fuzz.register_fzzr(TAOX11CoutCerrChecker.new)
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_executablebit.rb - executable bit checker
|
4
|
+
#
|
5
|
+
# Author: Johnny Willemsen
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class ExecutablebitChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_executablebit
|
15
|
+
@description = 'checks for executable bit set'
|
16
|
+
end
|
17
|
+
|
18
|
+
OBJECT_EXTS = ['pl', 'sh', 'bat']
|
19
|
+
|
20
|
+
def applies_to?(object)
|
21
|
+
Fuzz::FileObject === object &&
|
22
|
+
OBJECT_EXTS.include?(object.ext) &&
|
23
|
+
!is_excluded?(object)
|
24
|
+
end
|
25
|
+
|
26
|
+
def run(object, apply_fix)
|
27
|
+
if !File::executable?(object.path)
|
28
|
+
Fuzz.log_error(%Q{#{object.path} - lacks executable bit})
|
29
|
+
false
|
30
|
+
end
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Fuzz.register_fzzr(ExecutablebitChecker.new)
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_exit_keyword.rb - TAOX11 exit checker
|
4
|
+
#
|
5
|
+
# Author: Marcel Smit
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11ExitChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_exit_keyword
|
15
|
+
@description = 'checks against the use of the exit keyword in test code'
|
16
|
+
@errormsg = 'detected use of exit'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /(^|\s+)(exit)(\s+|$)/
|
30
|
+
lnptr.mark_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Fuzz.register_fzzr(TAOX11ExitChecker.new)
|
37
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_fileheader.rb - TAOX11 file header checker
|
4
|
+
#
|
5
|
+
# Author: Marcel Smit
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11FileHeaderChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_fileheader
|
15
|
+
@description = 'checks whether a file contains a correct file header'
|
16
|
+
@errormsg = 'incorrect or no fileheader detected. Fileheaders should start on the first or second line, should have a size of 6 lines and the file name should be on the second line of the header.'
|
17
|
+
end
|
18
|
+
|
19
|
+
def applies_to?(object)
|
20
|
+
Fuzz::FileObject === object &&
|
21
|
+
!is_excluded?(object)
|
22
|
+
end
|
23
|
+
|
24
|
+
def run(object, apply_fix)
|
25
|
+
header_start = nil
|
26
|
+
script = false
|
27
|
+
object.iterate(fuzz_id) do |lnptr|
|
28
|
+
case lnptr.line_nr
|
29
|
+
when 1
|
30
|
+
if lnptr.text =~ /^(\/[\*]|[#])/
|
31
|
+
if not lnptr.text =~ /^(#!)/
|
32
|
+
header_start = lnptr.line_nr
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if lnptr.text =~ /^[#]/
|
36
|
+
script = true
|
37
|
+
end
|
38
|
+
when 2
|
39
|
+
unless header_start
|
40
|
+
if not lnptr.text =~ /^(\/[\*]|[#])/
|
41
|
+
lnptr.mark_error 1
|
42
|
+
else
|
43
|
+
header_start = lnptr.line_nr
|
44
|
+
if lnptr.text =~ /^[#]/
|
45
|
+
script = true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
else
|
49
|
+
if lnptr.text =~ /[\*]\//
|
50
|
+
lnptr.mark_error
|
51
|
+
end
|
52
|
+
if not lnptr.text.match(object.name)
|
53
|
+
lnptr.mark_error
|
54
|
+
end
|
55
|
+
end
|
56
|
+
when 3
|
57
|
+
if header_start && header_start == 2
|
58
|
+
# header on second line so file name should
|
59
|
+
# be on the third
|
60
|
+
if not lnptr.text.match(object.name)
|
61
|
+
lnptr.mark_error
|
62
|
+
end
|
63
|
+
end
|
64
|
+
else
|
65
|
+
if header_start
|
66
|
+
# for */
|
67
|
+
if lnptr.text =~ /[\*]\//
|
68
|
+
hdr_lns = 1 + lnptr.line_nr - header_start
|
69
|
+
if hdr_lns < 6
|
70
|
+
lnptr.mark_error
|
71
|
+
lnptr.to_eof # stop
|
72
|
+
end
|
73
|
+
else
|
74
|
+
unless !script
|
75
|
+
# for scripts
|
76
|
+
if not lnptr.text =~ /[#]/
|
77
|
+
hdr_lns = 1 + lnptr.line_nr - header_start
|
78
|
+
if hdr_lns < 6
|
79
|
+
lnptr.mark_error
|
80
|
+
lnptr.to_eof # stop
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end # header_start
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end #def run
|
89
|
+
end
|
90
|
+
|
91
|
+
Fuzz.register_fzzr(TAOX11FileHeaderChecker.new)
|
92
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_filename.rb - TAOX11 filename fuzzer
|
4
|
+
#
|
5
|
+
# Author: Martin Corino
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class FilenameChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_filename
|
15
|
+
@description = 'checks against the use of uppercase in file/directory names'
|
16
|
+
end
|
17
|
+
|
18
|
+
def applies_to?(object)
|
19
|
+
!is_excluded?(object)
|
20
|
+
end
|
21
|
+
|
22
|
+
def run(object, apply_fix)
|
23
|
+
if object.name =~ /[A-Z]/
|
24
|
+
Fuzz.log_error(%Q{name for #{object.path} contains uppercase})
|
25
|
+
false
|
26
|
+
else
|
27
|
+
true
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Fuzz.register_fzzr(FilenameChecker.new)
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_id_tag.rb - TAOX11 $Id$ tag checker
|
4
|
+
#
|
5
|
+
# Author: Marcel Smit
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11IdTagChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_id_tag
|
15
|
+
@description = 'checks against the use of the $Id$ tag'
|
16
|
+
@errormsg = 'detected use of $Id:$'
|
17
|
+
end
|
18
|
+
|
19
|
+
def applies_to?(object)
|
20
|
+
Fuzz::FileObject === object &&
|
21
|
+
!is_excluded?(object)
|
22
|
+
end
|
23
|
+
|
24
|
+
def run(object, apply_fix)
|
25
|
+
object.iterate(fuzz_id) do |lnptr|
|
26
|
+
if lnptr.text =~ /^\s*([\*]|\/\/|#)\s*([\$]Id)/i
|
27
|
+
lnptr.mark_error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Fuzz.register_fzzr(TAOX11IdTagChecker.new)
|
34
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_new_delete.rb - TAOX11 new delete checker
|
4
|
+
#
|
5
|
+
# Author: Martin Corino
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11NewDeleteChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_new_delete
|
15
|
+
@description = 'checks against the use of new and/or delete in test code'
|
16
|
+
@errormsg = 'detected use of new and/or delete'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /(^|\s+)(new|delete)(\s+|$)/
|
30
|
+
lnptr.mark_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Fuzz.register_fzzr(TAOX11NewDeleteChecker.new)
|
37
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_printf_keyword.rb - TAOX11 printf checker
|
4
|
+
#
|
5
|
+
# Author: Johnny Willemsen
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11PrintfChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_printf_keyword
|
15
|
+
@description = 'checks against the use of the printf keyword in test code'
|
16
|
+
@errormsg = 'detected use of printf'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /(^|\s+|::)(printf)(\s+|$)/
|
30
|
+
lnptr.mark_error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Fuzz.register_fzzr(TAOX11PrintfChecker.new)
|
37
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# -------------------------------------------------------------------
|
3
|
+
# check_taox11_namespace.rb - TAOX11 namespace checker
|
4
|
+
#
|
5
|
+
# Author: Martin Corino
|
6
|
+
#
|
7
|
+
# Copyright (c) Remedy IT Expertise BV
|
8
|
+
# -------------------------------------------------------------------
|
9
|
+
|
10
|
+
module Fuzzers
|
11
|
+
class TAOX11NamespaceChecker
|
12
|
+
include Fuzz::Fzzr
|
13
|
+
def initialize
|
14
|
+
@fuzz_id = :check_taox11_namespace
|
15
|
+
@description = 'checks against the use of the TAOX11_NAMESPACE macro in user/test code'
|
16
|
+
@errormsg = 'detected use TAOX11_xxx namespace macro'
|
17
|
+
end
|
18
|
+
|
19
|
+
OBJECT_EXTS = ['h', 'hxx', 'hpp', 'c', 'cc', 'cxx', 'cpp', 'H', 'C']
|
20
|
+
|
21
|
+
def applies_to?(object)
|
22
|
+
Fuzz::FileObject === object &&
|
23
|
+
OBJECT_EXTS.include?(object.ext) &&
|
24
|
+
!is_excluded?(object)
|
25
|
+
end
|
26
|
+
|
27
|
+
def run(object, apply_fix)
|
28
|
+
object.iterate(fuzz_id) do |lnptr|
|
29
|
+
if lnptr.text =~ /(TAOX11_NAMESPACE|TAOX11_CORBA|TAOX11_PORTABLE_SERVER)::/ ||
|
30
|
+
lnptr.text =~ /namespace\s+(TAOX11_NAMESPACE|TAOX11_CORBA|TAOX11_PORTABLE_SERVER)/
|
31
|
+
lnptr.mark_error
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Fuzz.register_fzzr(TAOX11NamespaceChecker.new)
|
38
|
+
end
|
data/lib/fuzz/console.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
#--------------------------------------------------------------------
|
2
|
+
# @file console.rb
|
3
|
+
# @author Martin Corino
|
4
|
+
#
|
5
|
+
# @brief Fuzz console wrapper
|
6
|
+
#
|
7
|
+
# @copyright Copyright (c) Remedy IT Expertise BV
|
8
|
+
#--------------------------------------------------------------------
|
9
|
+
require 'fuzz/screen'
|
10
|
+
|
11
|
+
module Fuzz
|
12
|
+
|
13
|
+
module Console
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def screen
|
17
|
+
@screen ||= Screen.new(Fuzz.options[:output] || $stdout, $stdin)
|
18
|
+
end
|
19
|
+
include Screen::ColorizeMethods
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.print(*args)
|
23
|
+
screen.print(*args)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.println(*args)
|
27
|
+
screen.println(*args)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.error_print(*args)
|
31
|
+
screen.error_print(*args)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.error_println(*args)
|
35
|
+
screen.error_println(*args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.colorizer_include
|
39
|
+
Screen::ColorizeMethods
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.display_break
|
43
|
+
println("\n")
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.display_hline(len = nil)
|
47
|
+
println("#{'-' * (len || [80, (screen.output_cols / 5 * 4)].min)}\n")
|
48
|
+
end
|
49
|
+
|
50
|
+
end # Console
|
51
|
+
|
52
|
+
end # Fuzz
|