Fix heap buffer overflow in yaml_emitter_emit_flow_mapping_key

This commit is contained in:
David Tolnay 2022-07-27 18:06:55 -07:00
parent 90b50bb321
commit b1cc5567b2
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -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);