Commit Graph

25 Commits

Author SHA1 Message Date
Alastair Donaldson
c5ee1bc7bd
Fix opt fuzzer test harness (#4670)
The test harness for the opt fuzzer was failing to consider that the
input might use a very large id bound, despite no id approaching this
bound actually being used.

This change modifies the test harness to use the module's id bound,
rather than looking through the module for large ids.

Fixes: oss-fuzz:42386
2022-01-07 15:03:29 +00:00
Alastair Donaldson
f0351b7bc6
Avoid id bound errors during opt fuzzing (#4658)
Use a very large id bound when fuzzing the optimizer, and check that the
input does not ids that are too close to this bound. This should make it
impossible in practice for an id overflow to occur.

Fixes #4657.
2021-12-13 10:56:52 +00:00
Alastair Donaldson
e452792594
Simplify the as fuzzer target (#4647)
Makes the logic in the as fuzzer target closer to the logic of the
spirv-as tool.

Fixes #4643
2021-12-10 10:06:23 -05:00
Alastair Donaldson
8c91f14a9b
Add libFuzzer target for spirv-fuzz (#4434)
Fixes #4431.
2021-10-26 15:24:51 +00:00
Alastair Donaldson
0f3bc1d9b2
Fix i386 build issues related to random generation (#4586)
The OSS-Fuzz i386 build has been failing due to errors about
64-to-32-bit conversions, relating to random generation code. This
changre fixes the problem by explicitly using a 64-bit random generator,
and by adding a cast to size_t to avoid an implicit conversion.
2021-10-20 10:20:07 -04:00
Ryan Harrison
d31218c560
Use max enum instead of static array of legal values (#4571) 2021-10-13 17:53:11 -04:00
Ryan Harrison
2d12367ced
Stop consuming input in fuzzers to select target environment (#4544)
Instead calculate a hash based on the input and use that as a seed
into random data generation for the target env.

Also fixes issue where input data was not actually being fed into
one fuzzer.

Fixes #4450
2021-10-04 13:42:12 -04:00
Alastair Donaldson
0f4508752f
Fix UBSan error in spirv-dis fuzzer (#4517)
Pending a more general solution for constructing a target environment
based on the bytes of a test input, this change avoids a UBSan error
caused by the existing approach.

Fixes https://crbug.com/38087
2021-09-21 15:07:30 +00:00
Alastair Donaldson
789de0dc4b
Adjust build for fuzzer targets to support OSS-Fuzz (#4498)
With OSS-Fuzz, the build system should not directly set options such as
-fsanitize=fuzzer. Instead, these are set by OSS-Fuzz, and
linker options are provided via the LIB_FUZZER_OPTIONS environment
variable. This change allows the fuzzers to be build stand-alone,
outside of OSS-Fuzz, in the way that was already supported, as well as
inside OSS-Fuzz, when the LIB_FUZZER_OPTIONS environment variable is
set.
2021-09-02 22:55:30 +00:00
Alastair Donaldson
3ab6fb9c03
Add CMake rules for libFuzzer targets (#4445)
Adds CMake rules for the libFuzzer targets, with a view to running
them on OSS-Fuzz.

Fixes #4448.
2021-08-05 08:11:21 +00:00
Alastair Donaldson
affe280c22
Add GraphicsFuzz shaders to fuzzer corpus (#4429)
Adds a set of SPIR-V shaders to the corpus used for fuzzing.

Fixes #4428.
2021-08-03 15:27:03 +01:00
Ryan Harrison
9150cd441f
Remove WebGPU support (#4108)
Leaves SPV_ENV_WEBGPU_0 enum in place, but marked deprecated, so users
of the library are not broken by an API enum being removed.

Fixes #4101
2021-01-14 16:45:18 -05:00
Ryan Harrison
45dde9ad6d
Add missing dealloc (#3061)
Fixes #3060
2019-11-20 10:38:35 -05:00
Ryan Harrison
2ee9aaa288
Initialize binary for use as guard later (#3058)
Fixes #3057
2019-11-19 16:25:06 -05:00
Ryan Harrison
5f6fb2f346
Reset pointers before iterating in fuzzer to avoid double free (#3003)
Fixes #3002
2019-11-01 11:39:05 -04:00
Ryan Harrison
2ca4fcfdc2
Add fuzzer for spirv-dis call path (#2977)
Fixes #2970
2019-10-17 12:30:47 -04:00
Ryan Harrison
8e89778531
Add fuzzer for spirv-as call path (#2976)
Fixes #2969
2019-10-16 15:25:03 -04:00
Ryan Harrison
19b256616d
For WebGPU<->Vulkan optimization, set correct execution environment (#2834)
Fixes #2833
2019-09-04 13:08:58 -04:00
Ryan Harrison
f051812343
Add WebGPU specific fuzzer for validation (#2628)
Fixes #2627
2019-05-28 11:51:52 -07:00
Ryan Harrison
5a06fa4661
Add fuzzer for Vulkan->WebGPU spirv-opt passes (#2626)
Fixes #2622
2019-05-28 10:11:43 -07:00
Ryan Harrison
78b2b18661
Add fuzzer for WebGPU->Vulkan spirv-opt passes (#2625)
Fixes #2623
2019-05-28 07:18:03 -07:00
Ryan Harrison
5beeee15c1 Add fuzzer for spvBinaryParser (#2045)
Add fuzzer for spvBinaryParser
2018-11-14 10:30:20 -05:00
Corentin Wallez
21bcb9d8b9 BUILD.gn: Make a better interface with dependents. (#1877)
This splits the spvtools_config into a public and private part to avoid
leaking internal bits to dependents. A new target is added for the
public headers so that "gn check" works for dependents.

Also formats test/fuzzers/BUILD.gn
2018-09-06 10:50:27 -04:00
dan sinclair
eda2cfbe12
Cleanup includes. (#1795)
This Cl cleans up the include paths to be relative to the top level
directory. Various include-what-you-use fixes have been added.
2018-08-03 15:06:09 -04:00
Corentin Wallez
2d9a325264 Refactor BUILD.gn so can easily be embedded in other projects
1.
BUILD.gn: Don't use the extra Chromium clang warnings

Also removes the unused .gn secondary_sources.

2.

Move fuzzers in test/ instead of testing/

This frees up testing/ to be the git subtree of Chromium's src/testing/
that contains test.gni, gtest, gmock and libfuzzer

3.

DEPS: get the whole testing/ subtree of Chromium

4.

BUILD.gn: Simplify the standalone gtest targets

These targets definitions are inspired from ANGLE's and add a variable
that is the path of the googletest directory so that it can be made
overridable in future commits.

6.

BUILD.gn: Add overridable variables for deps dirs

This avoids hardcoded paths to dependencies that make it hard to
integrate SPIRV-Tools in other GN projects.
2018-08-03 10:06:11 -04:00