summaryrefslogtreecommitdiff
path: root/ext/psych/yaml/scanner.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/yaml/scanner.c')
-rw-r--r--ext/psych/yaml/scanner.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/ext/psych/yaml/scanner.c b/ext/psych/yaml/scanner.c
index d8d9032..b6f5185 100644
--- a/ext/psych/yaml/scanner.c
+++ b/ext/psych/yaml/scanner.c
@@ -1188,7 +1188,7 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
{
if (parser->flow_level) {
parser->flow_level --;
- (void)POP(parser, parser->simple_keys);
+ (void)POP(parser, parser->simple_keys);
}
return 1;
@@ -1636,7 +1636,7 @@ yaml_parser_fetch_key(yaml_parser_t *parser)
if (!parser->flow_level)
{
- /* Check if we are allowed to start a new key (not necessary simple). */
+ /* Check if we are allowed to start a new key (not nessesary simple). */
if (!parser->simple_key_allowed) {
return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
@@ -2399,7 +2399,7 @@ yaml_parser_scan_tag(yaml_parser_t *parser, yaml_token_t *token)
{
/* Set the handle to '' */
- handle = yaml_malloc(1);
+ handle = YAML_MALLOC(1);
if (!handle) goto error;
handle[0] = '\0';
@@ -2451,7 +2451,7 @@ yaml_parser_scan_tag(yaml_parser_t *parser, yaml_token_t *token)
/* Set the handle to '!'. */
yaml_free(handle);
- handle = yaml_malloc(2);
+ handle = YAML_MALLOC(2);
if (!handle) goto error;
handle[0] = '!';
handle[1] = '\0';
@@ -3160,8 +3160,8 @@ yaml_parser_scan_flow_scalar(yaml_parser_t *parser, yaml_token_t *token,
*(string.pointer++) = '"';
break;
- case '\'':
- *(string.pointer++) = '\'';
+ case '/':
+ *(string.pointer++) = '/';
break;
case '\\':
@@ -3278,6 +3278,11 @@ yaml_parser_scan_flow_scalar(yaml_parser_t *parser, yaml_token_t *token,
/* Check if we are at the end of the scalar. */
+ /* Fix for crash unitialized value crash
+ * Credit for the bug and input is to OSS Fuzz
+ * Credit for the fix to Alex Gaynor
+ */
+ if (!CACHE(parser, 1)) goto error;
if (CHECK(parser->buffer, single ? '\'' : '"'))
break;
@@ -3502,12 +3507,12 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
{
if (IS_BLANK(parser->buffer))
{
- /* Check for tab characters that abuse indentation. */
+ /* Check for tab character that abuse indentation. */
if (leading_blanks && (int)parser->mark.column < indent
&& IS_TAB(parser->buffer)) {
yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
- start_mark, "found a tab character that violates indentation");
+ start_mark, "found a tab character that violate indentation");
goto error;
}
@@ -3571,4 +3576,3 @@ error:
return 0;
}
-