Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from dtolnay/bufferoverflow
Browse files Browse the repository at this point in the history
Fix heap buffer overflow in yaml_emitter_emit_flow_mapping_key
  • Loading branch information
dtolnay authored Jul 28, 2022
2 parents 90b50bb + b1cc556 commit 1884364
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,9 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
*fresh18 += 1;
}
if (*event).type_ == YAML_MAPPING_END_EVENT {
if STACK_EMPTY!((*emitter).indents) {
return FAIL;
}
let fresh19 = addr_of_mut!((*emitter).flow_level);
*fresh19 -= 1;
(*emitter).indent = POP!((*emitter).indents);
Expand Down

0 comments on commit 1884364

Please sign in to comment.