Lower memory threshold for parse_tensor_op_fuzz

This is needed because ASAN builds have additional checks with additional memory footprint so fuzzer that was at the borderline just below OOM threshold now OOMs.

PiperOrigin-RevId: 343538697
Change-Id: I42672e103bdc95b65c5a8d37578fc4eb796050a0
This commit is contained in:
Mihai Maruseac 2020-11-20 12:07:05 -08:00 committed by TensorFlower Gardener
parent 2139560d99
commit 5abf12375e

View File

@ -41,6 +41,8 @@ class FuzzParseTensor : public FuzzSession {
// remainder of the fuzzer testing. Of course, this duplicates some work
// but it's better than repeating the investigation whenever Autofuzz
// detects another similar OOM.
// After adding `-fsanitize=null` to ASAN (cl/317376103), the memory
// footprint increased, so we lower the maximum threshold to 2^18.
string as_string = string(reinterpret_cast<const char*>(data), size);
TensorProto proto;
if (!ParseProtoUnlimited(&proto, as_string)) {
@ -53,7 +55,7 @@ class FuzzParseTensor : public FuzzSession {
}
TensorShape shape(proto.tensor_shape());
const int64 num_elements = shape.num_elements();
const int64 max_num_elements = 1 << 20;
const int64 max_num_elements = 1 << 18;
if (num_elements > max_num_elements) {
LOG(WARNING) << "Requiring a tensor with too many elements\n";
return;