Fix http_parser check for architectures with unsigned chars

http_parser.c has a table named "unhex" that it uses to convert hex
characters to their numeric values, e.g. 'F' -> 15. For non-hex
characters, the value is -1 but while the table contains int8_t values,
the extraction is done using a char. On ARMv8, char is *unsigned*, which
means it can't be compared to -1 as this is always false. Comparing to
(char)-1 instead will work.
master
Jessie Murray 3 years ago committed by Nicolas Favre-Felix
parent 74d4092ac6
commit 55128ae263
No known key found for this signature in database
GPG Key ID: C04E7AA8B6F73372

@ -1440,7 +1440,7 @@ size_t http_parser_execute (http_parser *parser,
assert(parser->flags & F_CHUNKED); assert(parser->flags & F_CHUNKED);
c = unhex[(unsigned char)ch]; c = unhex[(unsigned char)ch];
if (c == -1) goto error; if (c == (char)-1) goto error;
parser->content_length = c; parser->content_length = c;
state = s_chunk_size; state = s_chunk_size;
break; break;
@ -1457,7 +1457,7 @@ size_t http_parser_execute (http_parser *parser,
c = unhex[(unsigned char)ch]; c = unhex[(unsigned char)ch];
if (c == -1) { if (c == (char)-1) {
if (ch == ';' || ch == ' ') { if (ch == ';' || ch == ' ') {
state = s_chunk_parameters; state = s_chunk_parameters;
break; break;

Loading…
Cancel
Save