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

Function ParseDictionaryFile

fuzz/libfuzzer/FuzzerUtil.cpp:127–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127bool ParseDictionaryFile(const std::string &Text, std::vector<Unit> *Units) {
128 if (Text.empty()) {
129 Printf("ParseDictionaryFile: file does not exist or is empty\n");
130 return false;
131 }
132 std::istringstream ISS(Text);
133 Units->clear();
134 Unit U;
135 int LineNo = 0;
136 std::string S;
137 while (std::getline(ISS, S, '\n')) {
138 LineNo++;
139 size_t Pos = 0;
140 while (Pos < S.size() && isspace(S[Pos])) Pos++; // Skip spaces.
141 if (Pos == S.size()) continue; // Empty line.
142 if (S[Pos] == '#') continue; // Comment line.
143 if (ParseOneDictionaryEntry(S, &U)) {
144 Units->push_back(U);
145 } else {
146 Printf("ParseDictionaryFile: error in line %d\n\t\t%s\n", LineNo,
147 S.c_str());
148 return false;
149 }
150 }
151 return true;
152}
153
154// Code duplicated (and tested) in llvm/include/llvm/Support/Base64.h
155std::string Base64(const Unit &U) {

Callers 2

FuzzerDriverFunction · 0.85
TESTFunction · 0.85

Calls 7

ParseOneDictionaryEntryFunction · 0.85
PrintfFunction · 0.70
emptyMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
c_strMethod · 0.45

Tested by 1

TESTFunction · 0.68