diff options
author | Fabian Meumertzheim <meumertzheim@code-intelligence.com> | 2021-03-08 16:01:14 +0100 |
---|---|---|
committer | Fabian Meumertzheim <fabian@meumertzhe.im> | 2021-03-08 16:17:04 +0100 |
commit | e51010f4a73d3665f8bb7aab1ac990580ccb5d36 (patch) | |
tree | 4daa6247617ea242dc6495350ef00b446ec815e8 /examples/src | |
parent | e884cf54fe9b70dcbef1aff3c94f1bb5d08949c8 (diff) | |
download | jazzer-api-e51010f4a73d3665f8bb7aab1ac990580ccb5d36.tar.gz |
Add Kotlin fuzz target
Diffstat (limited to 'examples/src')
-rw-r--r-- | examples/src/main/java/com/example/KlaxonFuzzer.kt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/src/main/java/com/example/KlaxonFuzzer.kt b/examples/src/main/java/com/example/KlaxonFuzzer.kt new file mode 100644 index 00000000..39216eea --- /dev/null +++ b/examples/src/main/java/com/example/KlaxonFuzzer.kt @@ -0,0 +1,31 @@ +// Copyright 2021 Code Intelligence GmbH +// +// 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. + +package com.example + +import com.beust.klaxon.KlaxonException +import com.beust.klaxon.Parser +import com.code_intelligence.jazzer.api.FuzzedDataProvider + +// Reproduces https://github.com/cbeust/klaxon/pull/330 +object KlaxonFuzzer { + + @JvmStatic + fun fuzzerTestOneInput(data: FuzzedDataProvider) { + try { + Parser.default().parse(StringBuilder(data.consumeRemainingAsString())) + } catch (_: KlaxonException) { + } + } +} |