From b1cc5567b2e083e1eeec2fa480839d17c32ccd1e Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 27 Jul 2022 18:06:55 -0700 Subject: [PATCH] Fix heap buffer overflow in yaml_emitter_emit_flow_mapping_key --- src/emitter.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/emitter.rs b/src/emitter.rs index c4e7d76..1388a69 100644 --- a/src/emitter.rs +++ b/src/emitter.rs @@ -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);