mirror of https://github.com/google/oss-fuzz.git
face: initial integration (#9685)
Signed-off-by: David Korczynski <david@adalogics.com> --------- Signed-off-by: David Korczynski <david@adalogics.com>
This commit is contained in:
parent
25d0751e7b
commit
9395b065f7
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/python3
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
FROM gcr.io/oss-fuzz-base/base-builder-python
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN git clone https://github.com/mahmoud/face face
|
||||
COPY *.sh *py $SRC/
|
||||
WORKDIR $SRC/face
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash -eu
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
################################################################################
|
||||
pip3 install .
|
||||
# Build fuzzers in $OUT.
|
||||
for fuzzer in $(find $SRC -name 'fuzz_*.py'); do
|
||||
compile_python_fuzzer $fuzzer
|
||||
done
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/python3
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import sys
|
||||
import atheris
|
||||
|
||||
import face
|
||||
|
||||
|
||||
def empty():
|
||||
return
|
||||
|
||||
|
||||
def TestOneInput(data):
|
||||
fdp = atheris.FuzzedDataProvider(data)
|
||||
args = []
|
||||
for idx in range(fdp.ConsumeIntInRange(1, 100)):
|
||||
args.append(fdp.ConsumeUnicodeNoSurrogates(124))
|
||||
|
||||
cmd = face.Command(empty, name='fuzz')
|
||||
for idx in range(fdp.ConsumeIntInRange(1, 15)):
|
||||
try:
|
||||
cmd.add(fdp.ConsumeUnicodeNoSurrogates(64),
|
||||
char=fdp.ConsumeUnicodeNoSurrogates(5),
|
||||
parse_as=fdp.ConsumeBool(),
|
||||
doc=fdp.ConsumeUnicodeNoSurrogates(64))
|
||||
except face.errors.FaceException:
|
||||
pass
|
||||
except ValueError:
|
||||
# Raised by face: https://github.com/mahmoud/face/blob/eb56873b9081852f4500b1a61f178ca0cc8666bc/face/utils.py#L80
|
||||
pass
|
||||
|
||||
# Create a command and parse the args
|
||||
try:
|
||||
cmd.parse(args)
|
||||
except face.errors.FaceException:
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
atheris.instrument_all()
|
||||
atheris.Setup(sys.argv, TestOneInput)
|
||||
atheris.Fuzz()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/python3
|
||||
# Copyright 2023 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import sys
|
||||
import atheris
|
||||
|
||||
import face
|
||||
|
||||
|
||||
def TestOneInput(data):
|
||||
fdp = atheris.FuzzedDataProvider(data)
|
||||
args = []
|
||||
for idx in range(fdp.ConsumeIntInRange(1, 100)):
|
||||
args.append(fdp.ConsumeUnicodeNoSurrogates(124))
|
||||
|
||||
# Create a command and parse the args
|
||||
cmd = face.Command(lambda flag, part: None, name='cmd')
|
||||
try:
|
||||
cmd.parse(args)
|
||||
except face.errors.FaceException:
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
atheris.instrument_all()
|
||||
atheris.Setup(sys.argv, TestOneInput)
|
||||
atheris.Fuzz()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,10 @@
|
|||
homepage: https://github.com/mahmoud/face
|
||||
main_repo: https://github.com/mahmoud/face
|
||||
language: python
|
||||
fuzzing_engines:
|
||||
- libfuzzer
|
||||
sanitizers:
|
||||
- address
|
||||
- undefined
|
||||
vendor_ccs:
|
||||
- david@adalogics.com
|
Loading…
Reference in New Issue