Remove malloc null checks

This commit is contained in:
David Tolnay 2022-07-30 00:57:32 -07:00
parent 5d421b89e9
commit 85bc4324fc
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
5 changed files with 180 additions and 260 deletions

View file

@ -59,9 +59,6 @@ pub(crate) unsafe fn yaml_string_extend(
*start as *mut libc::c_void, *start as *mut libc::c_void,
((*end).c_offset_from(*start) as libc::c_long * 2_i64) as size_t, ((*end).c_offset_from(*start) as libc::c_long * 2_i64) as size_t,
) as *mut yaml_char_t; ) as *mut yaml_char_t;
if new_start.is_null() {
return FAIL;
}
memset( memset(
new_start.wrapping_offset((*end).c_offset_from(*start) as libc::c_long as isize) new_start.wrapping_offset((*end).c_offset_from(*start) as libc::c_long as isize)
as *mut libc::c_void, as *mut libc::c_void,
@ -118,9 +115,6 @@ pub(crate) unsafe fn yaml_stack_extend(
((*end as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long ((*end as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long
* 2_i64) as size_t, * 2_i64) as size_t,
); );
if new_start.is_null() {
return FAIL;
}
*top = (new_start as *mut libc::c_char).wrapping_offset( *top = (new_start as *mut libc::c_char).wrapping_offset(
(*top as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long (*top as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long
as isize, as isize,
@ -145,9 +139,6 @@ pub(crate) unsafe fn yaml_queue_extend(
((*end as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long ((*end as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long
* 2_i64) as size_t, * 2_i64) as size_t,
); );
if new_start.is_null() {
return FAIL;
}
*head = (new_start as *mut libc::c_char).wrapping_offset( *head = (new_start as *mut libc::c_char).wrapping_offset(
(*head as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long (*head as *mut libc::c_char).c_offset_from(*start as *mut libc::c_char) as libc::c_long
as isize, as isize,
@ -697,13 +688,9 @@ pub unsafe fn yaml_document_start_event_initialize(
if !version_directive.is_null() { if !version_directive.is_null() {
version_directive_copy = yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong) version_directive_copy = yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong)
as *mut yaml_version_directive_t; as *mut yaml_version_directive_t;
if version_directive_copy.is_null() { (*version_directive_copy).major = (*version_directive).major;
current_block = 14964981520188694172; (*version_directive_copy).minor = (*version_directive).minor;
} else { current_block = 1394248824506584008;
(*version_directive_copy).major = (*version_directive).major;
(*version_directive_copy).minor = (*version_directive).minor;
current_block = 1394248824506584008;
}
} else { } else {
current_block = 1394248824506584008; current_block = 1394248824506584008;
} }
@ -924,33 +911,31 @@ pub unsafe fn yaml_scalar_event_initialize(
} }
if yaml_check_utf8(value, length as size_t).ok { if yaml_check_utf8(value, length as size_t).ok {
value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t; value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t;
if !value_copy.is_null() { memcpy(
memcpy( value_copy as *mut libc::c_void,
value_copy as *mut libc::c_void, value as *const libc::c_void,
value as *const libc::c_void, length as libc::c_ulong,
length as libc::c_ulong, );
); *value_copy.wrapping_offset(length as isize) = b'\0';
*value_copy.wrapping_offset(length as isize) = b'\0'; memset(
memset( event as *mut libc::c_void,
event as *mut libc::c_void, 0,
0, size_of::<yaml_event_t>() as libc::c_ulong,
size_of::<yaml_event_t>() as libc::c_ulong, );
); (*event).type_ = YAML_SCALAR_EVENT;
(*event).type_ = YAML_SCALAR_EVENT; (*event).start_mark = mark;
(*event).start_mark = mark; (*event).end_mark = mark;
(*event).end_mark = mark; let fresh168 = addr_of_mut!((*event).data.scalar.anchor);
let fresh168 = addr_of_mut!((*event).data.scalar.anchor); *fresh168 = anchor_copy;
*fresh168 = anchor_copy; let fresh169 = addr_of_mut!((*event).data.scalar.tag);
let fresh169 = addr_of_mut!((*event).data.scalar.tag); *fresh169 = tag_copy;
*fresh169 = tag_copy; let fresh170 = addr_of_mut!((*event).data.scalar.value);
let fresh170 = addr_of_mut!((*event).data.scalar.value); *fresh170 = value_copy;
*fresh170 = value_copy; (*event).data.scalar.length = length as size_t;
(*event).data.scalar.length = length as size_t; (*event).data.scalar.plain_implicit = plain_implicit;
(*event).data.scalar.plain_implicit = plain_implicit; (*event).data.scalar.quoted_implicit = quoted_implicit;
(*event).data.scalar.quoted_implicit = quoted_implicit; (*event).data.scalar.style = style;
(*event).data.scalar.style = style; return OK;
return OK;
}
} }
} }
} }
@ -1253,13 +1238,9 @@ pub unsafe fn yaml_document_initialize(
version_directive_copy = version_directive_copy =
yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong) yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong)
as *mut yaml_version_directive_t; as *mut yaml_version_directive_t;
if version_directive_copy.is_null() { (*version_directive_copy).major = (*version_directive).major;
current_block = 8142820162064489797; (*version_directive_copy).minor = (*version_directive).minor;
} else { current_block = 7746791466490516765;
(*version_directive_copy).major = (*version_directive).major;
(*version_directive_copy).minor = (*version_directive).minor;
current_block = 7746791466490516765;
}
} else { } else {
current_block = 7746791466490516765; current_block = 7746791466490516765;
} }
@ -1480,29 +1461,27 @@ pub unsafe fn yaml_document_add_scalar(
} }
if yaml_check_utf8(value, length as size_t).ok { if yaml_check_utf8(value, length as size_t).ok {
value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t; value_copy = yaml_malloc((length + 1) as size_t) as *mut yaml_char_t;
if !value_copy.is_null() { memcpy(
memcpy( value_copy as *mut libc::c_void,
value_copy as *mut libc::c_void, value as *const libc::c_void,
value as *const libc::c_void, length as libc::c_ulong,
length as libc::c_ulong, );
); *value_copy.wrapping_offset(length as isize) = b'\0';
*value_copy.wrapping_offset(length as isize) = b'\0'; memset(
memset( node as *mut libc::c_void,
node as *mut libc::c_void, 0,
0, size_of::<yaml_node_t>() as libc::c_ulong,
size_of::<yaml_node_t>() as libc::c_ulong, );
); (*node).type_ = YAML_SCALAR_NODE;
(*node).type_ = YAML_SCALAR_NODE; (*node).tag = tag_copy;
(*node).tag = tag_copy; (*node).start_mark = mark;
(*node).start_mark = mark; (*node).end_mark = mark;
(*node).end_mark = mark; (*node).data.scalar.value = value_copy;
(*node).data.scalar.value = value_copy; (*node).data.scalar.length = length as size_t;
(*node).data.scalar.length = length as size_t; (*node).data.scalar.style = style;
(*node).data.scalar.style = style; if PUSH!(addr_of_mut!(context), (*document).nodes, *node).ok {
if PUSH!(addr_of_mut!(context), (*document).nodes, *node).ok { return (*document).nodes.top.c_offset_from((*document).nodes.start)
return (*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_int;
as libc::c_int;
}
} }
} }
} }

View file

@ -119,45 +119,41 @@ pub unsafe fn yaml_emitter_dump(
.wrapping_mul((*document).nodes.top.c_offset_from((*document).nodes.start) .wrapping_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
as libc::c_long as libc::c_ulong), as libc::c_long as libc::c_ulong),
) as *mut yaml_anchors_t; ) as *mut yaml_anchors_t;
if !(*emitter).anchors.is_null() { memset(
memset( (*emitter).anchors as *mut libc::c_void,
(*emitter).anchors as *mut libc::c_void, 0,
0, (size_of::<yaml_anchors_t>() as libc::c_ulong)
(size_of::<yaml_anchors_t>() as libc::c_ulong).wrapping_mul( .wrapping_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
(*document).nodes.top.c_offset_from((*document).nodes.start) as libc::c_long as libc::c_ulong),
as libc::c_long as libc::c_ulong, );
), memset(
); event as *mut libc::c_void,
memset( 0,
event as *mut libc::c_void, size_of::<yaml_event_t>() as libc::c_ulong,
0, );
size_of::<yaml_event_t>() as libc::c_ulong, (*event).type_ = YAML_DOCUMENT_START_EVENT;
); (*event).start_mark = mark;
(*event).type_ = YAML_DOCUMENT_START_EVENT; (*event).end_mark = mark;
(*event).start_mark = mark; (*event).data.document_start.version_directive = (*document).version_directive;
(*event).end_mark = mark; (*event).data.document_start.tag_directives.start =
(*event).data.document_start.version_directive = (*document).version_directive; (*document).tag_directives.start;
(*event).data.document_start.tag_directives.start = (*event).data.document_start.tag_directives.end = (*document).tag_directives.end;
(*document).tag_directives.start; (*event).data.document_start.implicit = (*document).start_implicit;
(*event).data.document_start.tag_directives.end = if yaml_emitter_emit(emitter, event).ok {
(*document).tag_directives.end; yaml_emitter_anchor_node(emitter, 1);
(*event).data.document_start.implicit = (*document).start_implicit; if yaml_emitter_dump_node(emitter, 1).ok {
if yaml_emitter_emit(emitter, event).ok { memset(
yaml_emitter_anchor_node(emitter, 1); event as *mut libc::c_void,
if yaml_emitter_dump_node(emitter, 1).ok { 0,
memset( size_of::<yaml_event_t>() as libc::c_ulong,
event as *mut libc::c_void, );
0, (*event).type_ = YAML_DOCUMENT_END_EVENT;
size_of::<yaml_event_t>() as libc::c_ulong, (*event).start_mark = mark;
); (*event).end_mark = mark;
(*event).type_ = YAML_DOCUMENT_END_EVENT; (*event).data.document_end.implicit = (*document).end_implicit;
(*event).start_mark = mark; if yaml_emitter_emit(emitter, event).ok {
(*event).end_mark = mark; yaml_emitter_delete_document_and_anchors(emitter);
(*event).data.document_end.implicit = (*document).end_implicit; return OK;
if yaml_emitter_emit(emitter, event).ok {
yaml_emitter_delete_document_and_anchors(emitter);
return OK;
}
} }
} }
} }
@ -261,9 +257,6 @@ unsafe fn yaml_emitter_generate_anchor(
anchor_id: libc::c_int, anchor_id: libc::c_int,
) -> *mut yaml_char_t { ) -> *mut yaml_char_t {
let anchor: *mut yaml_char_t = yaml_malloc(16_u64) as *mut yaml_char_t; let anchor: *mut yaml_char_t = yaml_malloc(16_u64) as *mut yaml_char_t;
if anchor.is_null() {
return ptr::null_mut::<yaml_char_t>();
}
write!(WriteToPtr::new(anchor), "id{:03}\0", anchor_id); write!(WriteToPtr::new(anchor), "id{:03}\0", anchor_id);
anchor anchor
} }
@ -278,9 +271,6 @@ unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_in
let mut anchor: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>(); let mut anchor: *mut yaml_char_t = ptr::null_mut::<yaml_char_t>();
if anchor_id != 0 { if anchor_id != 0 {
anchor = yaml_emitter_generate_anchor(emitter, anchor_id); anchor = yaml_emitter_generate_anchor(emitter, anchor_id);
if anchor.is_null() {
return FAIL;
}
} }
if (*(*emitter).anchors.wrapping_offset((index - 1) as isize)).serialized { if (*(*emitter).anchors.wrapping_offset((index - 1) as isize)).serialized {
return yaml_emitter_dump_alias(emitter, anchor); return yaml_emitter_dump_alias(emitter, anchor);

View file

@ -2,18 +2,13 @@ macro_rules! BUFFER_INIT {
($context:expr, $buffer:expr, $size:expr) => {{ ($context:expr, $buffer:expr, $size:expr) => {{
let start = addr_of_mut!($buffer.start); let start = addr_of_mut!($buffer.start);
*start = yaml_malloc($size as size_t) as *mut yaml_char_t; *start = yaml_malloc($size as size_t) as *mut yaml_char_t;
if !(*start).is_null() { let pointer = addr_of_mut!($buffer.pointer);
let pointer = addr_of_mut!($buffer.pointer); *pointer = $buffer.start;
*pointer = $buffer.start; let last = addr_of_mut!($buffer.last);
let last = addr_of_mut!($buffer.last); *last = *pointer;
*last = *pointer; let end = addr_of_mut!($buffer.end);
let end = addr_of_mut!($buffer.end); *end = $buffer.start.wrapping_add($size as usize);
*end = $buffer.start.wrapping_add($size as usize); OK
OK
} else {
(*$context).error = YAML_MEMORY_ERROR;
FAIL
}
}}; }};
} }
@ -42,15 +37,10 @@ macro_rules! STRING_ASSIGN {
macro_rules! STRING_INIT { macro_rules! STRING_INIT {
($context:expr, $string:expr) => {{ ($context:expr, $string:expr) => {{
$string.start = yaml_malloc(16) as *mut yaml_char_t; $string.start = yaml_malloc(16) as *mut yaml_char_t;
if !$string.start.is_null() { $string.pointer = $string.start;
$string.pointer = $string.start; $string.end = $string.start.wrapping_add(16);
$string.end = $string.start.wrapping_add(16); memset($string.start as *mut libc::c_void, 0, 16);
memset($string.start as *mut libc::c_void, 0, 16); OK
OK
} else {
(*$context).error = YAML_MEMORY_ERROR;
FAIL
}
}}; }};
} }
@ -374,14 +364,9 @@ macro_rules! COPY {
macro_rules! STACK_INIT { macro_rules! STACK_INIT {
($context:expr, $stack:expr, $type:ty) => {{ ($context:expr, $stack:expr, $type:ty) => {{
$stack.start = yaml_malloc(16 * size_of::<$type>() as libc::c_ulong) as *mut $type; $stack.start = yaml_malloc(16 * size_of::<$type>() as libc::c_ulong) as *mut $type;
if !$stack.start.is_null() { $stack.top = $stack.start;
$stack.top = $stack.start; $stack.end = $stack.start.offset(16_isize);
$stack.end = $stack.start.offset(16_isize); OK
OK
} else {
(*$context).error = YAML_MEMORY_ERROR;
FAIL
}
}}; }};
} }
@ -448,15 +433,10 @@ macro_rules! POP {
macro_rules! QUEUE_INIT { macro_rules! QUEUE_INIT {
($context:expr, $queue:expr, $type:ty) => {{ ($context:expr, $queue:expr, $type:ty) => {{
$queue.start = yaml_malloc(16 * size_of::<$type>() as libc::c_ulong) as *mut $type; $queue.start = yaml_malloc(16 * size_of::<$type>() as libc::c_ulong) as *mut $type;
if !$queue.start.is_null() { $queue.tail = $queue.start;
$queue.tail = $queue.start; $queue.head = $queue.tail;
$queue.head = $queue.tail; $queue.end = $queue.start.offset(16_isize);
$queue.end = $queue.start.offset(16_isize); OK
OK
} else {
(*$context).error = YAML_MEMORY_ERROR;
FAIL
}
}}; }};
} }

View file

@ -519,32 +519,25 @@ unsafe fn yaml_parser_parse_node(
tag = yaml_malloc( tag = yaml_malloc(
prefix_len.wrapping_add(suffix_len).wrapping_add(1_u64), prefix_len.wrapping_add(suffix_len).wrapping_add(1_u64),
) as *mut yaml_char_t; ) as *mut yaml_char_t;
if tag.is_null() { memcpy(
(*parser).error = YAML_MEMORY_ERROR; tag as *mut libc::c_void,
current_block = 17786380918591080555; (*tag_directive).prefix as *const libc::c_void,
break; prefix_len,
} else { );
memcpy( memcpy(
tag as *mut libc::c_void, tag.wrapping_offset(prefix_len as isize) as *mut libc::c_void,
(*tag_directive).prefix as *const libc::c_void, tag_suffix as *const libc::c_void,
prefix_len, suffix_len,
); );
memcpy( *tag.wrapping_offset(
tag.wrapping_offset(prefix_len as isize) prefix_len.wrapping_add(suffix_len) as isize
as *mut libc::c_void, ) = b'\0';
tag_suffix as *const libc::c_void, yaml_free(tag_handle as *mut libc::c_void);
suffix_len, yaml_free(tag_suffix as *mut libc::c_void);
); tag_suffix = ptr::null_mut::<yaml_char_t>();
*tag.wrapping_offset( tag_handle = tag_suffix;
prefix_len.wrapping_add(suffix_len) as isize current_block = 17728966195399430138;
) = b'\0'; break;
yaml_free(tag_handle as *mut libc::c_void);
yaml_free(tag_suffix as *mut libc::c_void);
tag_suffix = ptr::null_mut::<yaml_char_t>();
tag_handle = tag_suffix;
current_block = 17728966195399430138;
break;
}
} else { } else {
tag_directive = tag_directive.wrapping_offset(1); tag_directive = tag_directive.wrapping_offset(1);
} }
@ -705,31 +698,27 @@ unsafe fn yaml_parser_parse_node(
return OK; return OK;
} else if !anchor.is_null() || !tag.is_null() { } else if !anchor.is_null() || !tag.is_null() {
let value: *mut yaml_char_t = yaml_malloc(1_u64) as *mut yaml_char_t; let value: *mut yaml_char_t = yaml_malloc(1_u64) as *mut yaml_char_t;
if value.is_null() { *value = b'\0';
(*parser).error = YAML_MEMORY_ERROR; (*parser).state = POP!((*parser).states);
} else { memset(
*value = b'\0'; event as *mut libc::c_void,
(*parser).state = POP!((*parser).states); 0,
memset( size_of::<yaml_event_t>() as libc::c_ulong,
event as *mut libc::c_void, );
0, (*event).type_ = YAML_SCALAR_EVENT;
size_of::<yaml_event_t>() as libc::c_ulong, (*event).start_mark = start_mark;
); (*event).end_mark = end_mark;
(*event).type_ = YAML_SCALAR_EVENT; let fresh54 = addr_of_mut!((*event).data.scalar.anchor);
(*event).start_mark = start_mark; *fresh54 = anchor;
(*event).end_mark = end_mark; let fresh55 = addr_of_mut!((*event).data.scalar.tag);
let fresh54 = addr_of_mut!((*event).data.scalar.anchor); *fresh55 = tag;
*fresh54 = anchor; let fresh56 = addr_of_mut!((*event).data.scalar.value);
let fresh55 = addr_of_mut!((*event).data.scalar.tag); *fresh56 = value;
*fresh55 = tag; (*event).data.scalar.length = 0_u64;
let fresh56 = addr_of_mut!((*event).data.scalar.value); (*event).data.scalar.plain_implicit = implicit;
*fresh56 = value; (*event).data.scalar.quoted_implicit = false;
(*event).data.scalar.length = 0_u64; (*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
(*event).data.scalar.plain_implicit = implicit; return OK;
(*event).data.scalar.quoted_implicit = false;
(*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
return OK;
}
} else { } else {
yaml_parser_set_parser_error_context( yaml_parser_set_parser_error_context(
parser, parser,
@ -1257,15 +1246,11 @@ unsafe fn yaml_parser_parse_flow_mapping_value(
} }
unsafe fn yaml_parser_process_empty_scalar( unsafe fn yaml_parser_process_empty_scalar(
mut parser: *mut yaml_parser_t, _parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t, mut event: *mut yaml_event_t,
mark: yaml_mark_t, mark: yaml_mark_t,
) -> Success { ) -> Success {
let value: *mut yaml_char_t = yaml_malloc(1_u64) as *mut yaml_char_t; let value: *mut yaml_char_t = yaml_malloc(1_u64) as *mut yaml_char_t;
if value.is_null() {
(*parser).error = YAML_MEMORY_ERROR;
return FAIL;
}
*value = b'\0'; *value = b'\0';
memset( memset(
event as *mut libc::c_void, event as *mut libc::c_void,
@ -1359,14 +1344,8 @@ unsafe fn yaml_parser_process_directives(
version_directive = version_directive =
yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong) yaml_malloc(size_of::<yaml_version_directive_t>() as libc::c_ulong)
as *mut yaml_version_directive_t; as *mut yaml_version_directive_t;
if version_directive.is_null() { (*version_directive).major = (*token).data.version_directive.major;
(*parser).error = YAML_MEMORY_ERROR; (*version_directive).minor = (*token).data.version_directive.minor;
current_block = 17143798186130252483;
break;
} else {
(*version_directive).major = (*token).data.version_directive.major;
(*version_directive).minor = (*token).data.version_directive.minor;
}
} }
} else if (*token).type_ == YAML_TAG_DIRECTIVE_TOKEN { } else if (*token).type_ == YAML_TAG_DIRECTIVE_TOKEN {
let value = yaml_tag_directive_t { let value = yaml_tag_directive_t {

View file

@ -1173,7 +1173,7 @@ unsafe fn yaml_parser_scan_directive(
} }
unsafe fn yaml_parser_scan_directive_name( unsafe fn yaml_parser_scan_directive_name(
mut parser: *mut yaml_parser_t, parser: *mut yaml_parser_t,
start_mark: yaml_mark_t, start_mark: yaml_mark_t,
name: *mut *mut yaml_char_t, name: *mut *mut yaml_char_t,
) -> Success { ) -> Success {
@ -1405,7 +1405,7 @@ unsafe fn yaml_parser_scan_tag_directive_value(
} }
unsafe fn yaml_parser_scan_anchor( unsafe fn yaml_parser_scan_anchor(
mut parser: *mut yaml_parser_t, parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t, mut token: *mut yaml_token_t,
type_: yaml_token_type_t, type_: yaml_token_type_t,
) -> Success { ) -> Success {
@ -1505,35 +1505,31 @@ unsafe fn yaml_parser_scan_tag(
if CACHE(parser, 2_u64).ok { if CACHE(parser, 2_u64).ok {
if CHECK_AT!((*parser).buffer, b'<', 1) { if CHECK_AT!((*parser).buffer, b'<', 1) {
handle = yaml_malloc(1_u64) as *mut yaml_char_t; handle = yaml_malloc(1_u64) as *mut yaml_char_t;
if handle.is_null() { *handle = b'\0';
SKIP(parser);
SKIP(parser);
if yaml_parser_scan_tag_uri(
parser,
true,
false,
ptr::null_mut::<yaml_char_t>(),
start_mark,
addr_of_mut!(suffix),
)
.fail
{
current_block = 17708497480799081542;
} else if !CHECK!((*parser).buffer, b'>') {
yaml_parser_set_scanner_error(
parser,
b"while scanning a tag\0" as *const u8 as *const libc::c_char,
start_mark,
b"did not find the expected '>'\0" as *const u8 as *const libc::c_char,
);
current_block = 17708497480799081542; current_block = 17708497480799081542;
} else { } else {
*handle = b'\0';
SKIP(parser); SKIP(parser);
SKIP(parser); current_block = 4488286894823169796;
if yaml_parser_scan_tag_uri(
parser,
true,
false,
ptr::null_mut::<yaml_char_t>(),
start_mark,
addr_of_mut!(suffix),
)
.fail
{
current_block = 17708497480799081542;
} else if !CHECK!((*parser).buffer, b'>') {
yaml_parser_set_scanner_error(
parser,
b"while scanning a tag\0" as *const u8 as *const libc::c_char,
start_mark,
b"did not find the expected '>'\0" as *const u8 as *const libc::c_char,
);
current_block = 17708497480799081542;
} else {
SKIP(parser);
current_block = 4488286894823169796;
}
} }
} else if yaml_parser_scan_tag_handle(parser, false, start_mark, addr_of_mut!(handle)).fail } else if yaml_parser_scan_tag_handle(parser, false, start_mark, addr_of_mut!(handle)).fail
{ {
@ -1572,18 +1568,14 @@ unsafe fn yaml_parser_scan_tag(
} else { } else {
yaml_free(handle as *mut libc::c_void); yaml_free(handle as *mut libc::c_void);
handle = yaml_malloc(2_u64) as *mut yaml_char_t; handle = yaml_malloc(2_u64) as *mut yaml_char_t;
if handle.is_null() { *handle = b'!';
current_block = 17708497480799081542; *handle.wrapping_offset(1_isize) = b'\0';
} else { if *suffix == b'\0' {
*handle = b'!'; let tmp: *mut yaml_char_t = handle;
*handle.wrapping_offset(1_isize) = b'\0'; handle = suffix;
if *suffix == b'\0' { suffix = tmp;
let tmp: *mut yaml_char_t = handle;
handle = suffix;
suffix = tmp;
}
current_block = 4488286894823169796;
} }
current_block = 4488286894823169796;
} }
match current_block { match current_block {
17708497480799081542 => {} 17708497480799081542 => {}
@ -1634,7 +1626,7 @@ unsafe fn yaml_parser_scan_tag(
} }
unsafe fn yaml_parser_scan_tag_handle( unsafe fn yaml_parser_scan_tag_handle(
mut parser: *mut yaml_parser_t, parser: *mut yaml_parser_t,
directive: bool, directive: bool,
start_mark: yaml_mark_t, start_mark: yaml_mark_t,
handle: *mut *mut yaml_char_t, handle: *mut *mut yaml_char_t,