Previously we generated the following regression test source code:
fuzztest::ToByteArray("\0abc")
which was incorrect as it creates a zero length byte array as opposed to a 4 length one. The problem is that the passed string constant will be a const char*, which is handled as a C-string. C-strings are \0 terminated and thus parsing stops when it reaches the \0 character. With this fix we generate the following:
Fix source code generation for byte vectors.
Previously we generated the following regression test source code:
fuzztest::ToByteArray("\0abc")
which was incorrect as it creates a zero length byte array as opposed to a 4 length one. The problem is that the passed string constant will be a
const char*
, which is handled as a C-string. C-strings are\0
terminated and thus parsing stops when it reaches the \0 character. With this fix we generate the following:fuzztest::ToByteArray(std::string("\0abc",4))