mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-01-01 03:12:23 +08:00
Fix parsing of '' strings. found by AFL
This commit is contained in:
parent
a45c76721f
commit
2f2f789f48
@ -1196,7 +1196,7 @@ namespace chaiscript
|
||||
std::string match;
|
||||
|
||||
{
|
||||
// scope for cparser destrutor
|
||||
// scope for cparser destructor
|
||||
Char_Parser<std::string> cparser(match, false);
|
||||
|
||||
for (auto s = start + 1, end = m_position - 1; s != end; ++s) {
|
||||
@ -1204,6 +1204,10 @@ namespace chaiscript
|
||||
}
|
||||
}
|
||||
|
||||
if (match.size() != 1) {
|
||||
throw exception::eval_error("Single-quoted strings must be 1 character long", File_Position(m_position.line, m_position.col), *m_filename);
|
||||
}
|
||||
|
||||
m_match_stack.push_back(make_node<eval::Single_Quoted_String_AST_Node>(match, start.line, start.col));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -371,6 +371,9 @@ int main(int argc, char *argv[])
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
catch (const chaiscript::exception::load_module_error &e) {
|
||||
std::cout << "Unhandled module load error\n" << e.what() << '\n';
|
||||
}
|
||||
|
||||
// catch (std::exception &e) {
|
||||
// std::cout << e.what() << '\n';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user