MCPcopy Create free account
hub / github.com/HexHive/NASS / ParseDFTLine

Function ParseDFTLine

fuzz/libfuzzer/FuzzerDataFlowTrace.cpp:139–159  ·  view source on GitHub ↗

TODO(metzman): replace std::string with std::string_view for better performance. Need to figure our how to use string_view on Windows.

Source from the content-addressed store, hash-verified

137// TODO(metzman): replace std::string with std::string_view for
138// better performance. Need to figure our how to use string_view on Windows.
139static bool ParseDFTLine(const std::string &Line, size_t *FunctionNum,
140 std::string *DFTString) {
141 if (!Line.empty() && Line[0] != 'F')
142 return false; // Ignore coverage.
143 size_t SpacePos = Line.find(' ');
144 if (SpacePos == std::string::npos)
145 return ParseError("no space in the trace line", Line);
146 if (Line.empty() || Line[0] != 'F')
147 return ParseError("the trace line doesn't start with 'F'", Line);
148 *FunctionNum = std::atol(Line.c_str() + 1);
149 const char *Beg = Line.c_str() + SpacePos + 1;
150 const char *End = Line.c_str() + Line.size();
151 assert(Beg < End);
152 size_t Len = End - Beg;
153 for (size_t I = 0; I < Len; I++) {
154 if (Beg[I] != '0' && Beg[I] != '1')
155 return ParseError("the trace should contain only 0 or 1", Line);
156 }
157 *DFTString = Beg;
158 return true;
159}
160
161bool DataFlowTrace::Init(const std::string &DirPath, std::string *FocusFunction,
162 std::vector<SizedFile> &CorporaFiles, Random &Rand) {

Callers 1

InitMethod · 0.85

Calls 5

ParseErrorFunction · 0.85
emptyMethod · 0.45
findMethod · 0.45
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected