Fuzzing of native http1 parser

This commit is contained in:
Olof hagsand 2022-02-08 21:26:53 +01:00
parent 4aa74fa1d8
commit 51fd973642
8 changed files with 132 additions and 6 deletions

View file

@ -279,13 +279,13 @@ absolute_paths : absolute_paths absolute_path
{
if (($$ = clixon_string_del_join($1, "/", $2)) == NULL) { free($2); YYABORT;}
free($2);
_PARSE_DEBUG("absolute-paths -> absolute-paths absolute -path");
_PARSE_DEBUG("absolute-paths -> absolute-paths absolute-path");
}
| absolute_path
{
if (($$ = clixon_string_del_join(NULL, "/", $1)) == NULL) { free($1); YYABORT;}
free($1);
_PARSE_DEBUG("absolute-paths -> absolute -path");
_PARSE_DEBUG("absolute-paths -> absolute-path");
}
;
@ -326,10 +326,12 @@ header_fields : header_fields header_field CRLF
field-name = token */
header_field : TOKEN COLON ows field_values ows
{
if (http1_parse_header_field(_HY, $1, $4) < 0)
YYABORT;
if ($4){
if (http1_parse_header_field(_HY, $1, $4) < 0)
YYABORT;
free($4);
}
free($1);
free($4);
_PARSE_DEBUG("header-field -> field-name : field-values");
}
;
@ -342,7 +344,7 @@ field_values : field_vchars
$$ = $1; // XXX is there more than one??
_PARSE_DEBUG("field-values -> field-values field-vchars");
}
| { _PARSE_DEBUG("field-values -> "); }
| { $$ = NULL; _PARSE_DEBUG("field-values -> "); }
;