Add fuzzer for DecodeCSV Op.
We fix to only 4 columns in the fuzzer for now. PiperOrigin-RevId: 274923013 Change-Id: I734d102b278e4f6098650f8a4fc2596c21be9bd9
This commit is contained in:
parent
6141e99f13
commit
1745367d2f
tensorflow/core/kernels/fuzzing
@ -72,3 +72,7 @@ tf_ops_fuzz_target_lib("one_hot")
|
||||
tf_ops_fuzz_target_lib("scatter_nd")
|
||||
|
||||
tf_oss_fuzz_corpus("scatter_nd")
|
||||
|
||||
tf_ops_fuzz_target_lib("decode_csv")
|
||||
|
||||
tf_oss_fuzz_corpus("decode_csv")
|
||||
|
@ -0,0 +1,9 @@
|
||||
圹圹圹圹圹圹圹圹圹圹圹圹,,,,,,,,aa,圹,,,aa,"x","x(,",
|
||||
,"x(,","x(,",a,"x","x(,",
|
||||
,"x(,","xb",,,,,詾駻,,,,,,,,,,,,,,,,"x","x(,",
|
||||
,"x(,","x(,",a,"x","x(,",
|
||||
,"x(,","xb",圹圹圹圹圹圹圹圹,,,,,,,,aa,"x","x(,",
|
||||
,"x(,","x(,",a,"x","x(,",
|
||||
,"x(,","xb",,,,,詾駻,,,,,,,,,,,,,,,,"x","x(,",
|
||||
,"x(,","x(,",a,"x","x(,",
|
||||
,"x(,","xb",,,,,詾駻,,,,,,,,,,,,,,,,,,<,,,,,,,,,,,,,,,,<2C>,
|
@ -0,0 +1,2 @@
|
||||
a¨,b",
|
||||
,a,xd",,
|
@ -0,0 +1,2 @@
|
||||
a,,b,,,
|
||||
a&x",d,
|
@ -0,0 +1,2 @@
|
||||
cx""x",@@@À@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Àº@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Àº@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
,"a
|
@ -0,0 +1,4 @@
|
||||
,,bD
|
||||
Db
|
||||
a,,,fa;x",
|
||||
,
|
@ -0,0 +1 @@
|
||||
f,,,,b,",t,f,,b,b,",t,f,,b,"
|
38
tensorflow/core/kernels/fuzzing/decode_csv_fuzz.cc
Normal file
38
tensorflow/core/kernels/fuzzing/decode_csv_fuzz.cc
Normal file
@ -0,0 +1,38 @@
|
||||
/* Copyright 2016 Google Inc. All Rights Reserved.
|
||||
|
||||
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.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/cc/ops/standard_ops.h"
|
||||
#include "tensorflow/core/kernels/fuzzing/fuzz_session.h"
|
||||
|
||||
namespace tensorflow {
|
||||
namespace fuzzing {
|
||||
|
||||
class FuzzDecodeCsv : public FuzzStringInputOp {
|
||||
void BuildGraph(const Scope& scope) override {
|
||||
auto input =
|
||||
tensorflow::ops::Placeholder(scope.WithOpName("input"), DT_STRING);
|
||||
// For now, assume we want CSVs with 4 columns, as we need a refactoring
|
||||
// of the entire infrastructure to support the more complex usecase due to
|
||||
// the fact that graph generation and fuzzing data are at separate steps.
|
||||
InputList defaults = {Input("a"), Input("b"), Input("c"), Input("d")};
|
||||
(void)tensorflow::ops::DecodeCSV(scope.WithOpName("output"), input,
|
||||
defaults);
|
||||
}
|
||||
};
|
||||
|
||||
STANDARD_TF_FUZZ_FUNCTION(FuzzDecodeCsv);
|
||||
|
||||
} // end namespace fuzzing
|
||||
} // end namespace tensorflow
|
Loading…
Reference in New Issue
Block a user