Skip to content

Commit

Permalink
post #414: ensure there are no infinite loops
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed May 19, 2024
1 parent 73f6929 commit c8173f2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/c4/yml/parse_engine.def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ bool ParseEngine<EventHandler>::_scan_scalar_plain_blck(ScannedScalar *C4_RESTRI
{
case '-':
next_peeked = next_peeked.trimr("\n\r");
_c4dbgpf("doc begin? peeked=[{}]~~~{}{}~~~", next_peeked.len, next_peeked.first(3), next_peeked.len > 3 ? "..." : "");
_c4dbgpf("doc begin? peeked=[{}]~~~{}{}~~~", next_peeked.len, next_peeked.len >= 3 ? next_peeked.first(3) : next_peeked, next_peeked.len > 3 ? "..." : "");
if(_is_doc_begin_token(next_peeked))
{
_c4dbgp("doc begin! scalar ended");
Expand All @@ -1222,7 +1222,7 @@ bool ParseEngine<EventHandler>::_scan_scalar_plain_blck(ScannedScalar *C4_RESTRI
break;
case '.':
next_peeked = next_peeked.trimr("\n\r");
_c4dbgpf("doc end? peeked=[{}]~~~{}{}~~~", next_peeked.len, next_peeked.first(3), next_peeked.len > 3 ? "..." : "");
_c4dbgpf("doc end? peeked=[{}]~~~{}{}~~~", next_peeked.len, next_peeked.len >= 3 ? next_peeked.first(3) : next_peeked, next_peeked.len > 3 ? "..." : "");
if(_is_doc_end_token(next_peeked))
{
_c4dbgp("doc end! scalar ended");
Expand Down Expand Up @@ -2363,6 +2363,10 @@ auto ParseEngine<EventHandler>::_filter_squoted(FilterProcessor &C4_RESTRICT pro
proc.skip();
proc.copy();
}
else
{
_c4err("filter error");
}
break;
default:
proc.copy();
Expand Down Expand Up @@ -2482,7 +2486,7 @@ void ParseEngine<EventHandler>::_filter_dquoted_backslash(FilterProcessor &C4_RE
}
else if(next == '\r')
{
//proc.skip();
proc.skip();
}
else if(next == 'n')
{
Expand Down Expand Up @@ -5741,7 +5745,7 @@ void ParseEngine<EventHandler>::_handle_seq_block()
addrem_flags(RKEY, RNXT);
goto seqblck_finish;
}
else if(first != '*')
else //if(first != '*')
{
_c4err("parse error");
}
Expand Down Expand Up @@ -6596,6 +6600,7 @@ void ParseEngine<EventHandler>::_handle_map_block()
//
if(m_state->at_line_beginning())
{
_RYML_CB_ASSERT(m_evt_handler->m_stack.m_callbacks, m_state->line_contents.indentation != npos);
if(m_state->indentation_eq())
{
_c4dbgpf("mapblck[QMRK]: skip {} from indref", m_state->indref);
Expand Down

0 comments on commit c8173f2

Please sign in to comment.