@@ -615,11 +615,11 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser);
615615 */
616616
617617static int
618−yaml_parser_roll_indent(yaml_parser_t *parser, int column,
619− int number, yaml_token_type_t type, yaml_mark_t mark);
618+yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
619+ ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark);
620620
621621static int
622−yaml_parser_unroll_indent(yaml_parser_t *parser, int column);
622+yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column);
623623
624624/*
625625 * Token fetchers.
@@ -1103,7 +1103,7 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
11031103 */
11041104
11051105 int required = (!parser->flow_level
1106− && parser->indent == (int)parser->mark.column);
1106+ && parser->indent == (ptrdiff_t)parser->mark.column);
11071107
11081108 /*
11091109 * A simple key is required only when it is the first token in the current
@@ -1176,6 +1176,11 @@ yaml_parser_increase_flow_level(yaml_parser_t *parser)
11761176
11771177 /* Increase the flow level. */
11781178
1179+ if (parser->flow_level == INT_MAX) {
1180+ parser->error = YAML_MEMORY_ERROR;
1181+ return 0;
1182+ }
1183+
11791184 parser->flow_level++;
11801185
11811186 return 1;
@@ -1206,8 +1211,8 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
12061211 */
12071212
12081213static int
1209−yaml_parser_roll_indent(yaml_parser_t *parser, int column,
1210− int number, yaml_token_type_t type, yaml_mark_t mark)
1214+yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
1215+ ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark)
12111216{
12121217 yaml_token_t token;
12131218
@@ -1226,6 +1231,11 @@ yaml_parser_roll_indent(yaml_parser_t *parser, int column,
12261231 if (!PUSH(parser, parser->indents, parser->indent))
12271232 return 0;
12281233
1234+ if (column > INT_MAX) {
1235+ parser->error = YAML_MEMORY_ERROR;
1236+ return 0;
1237+ }
1238+
12291239 parser->indent = column;
12301240
12311241 /* Create a token and insert it into the queue. */
@@ -1254,7 +1264,7 @@ yaml_parser_roll_indent(yaml_parser_t *parser, int column,
12541264
12551265
12561266static int
1257−yaml_parser_unroll_indent(yaml_parser_t *parser, int column)
1267+yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
12581268{
12591269 yaml_token_t token;
12601270
@@ -2574,7 +2584,7 @@ yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
25742584
25752585 /* Resize the string to include the head. */
25762586
2577− while (string.end - string.start <= (int)length) {
2587+ while ((size_t)(string.end - string.start) <= length) {
25782588 if (!yaml_string_extend(&string.start, &string.pointer, &string.end)) {
25792589 parser->error = YAML_MEMORY_ERROR;
25802590 goto error;