Browse Source

[Fix] Use unsigned char and better support of utf8 in ragel parser

tags/2.6
Vsevolod Stakhov 3 years ago
parent
commit
76b8e42e1c
2 changed files with 3 additions and 2 deletions
  1. 1
    1
      src/ragel/content_disposition.rl
  2. 2
    1
      src/ragel/content_disposition_parser.rl

+ 1
- 1
src/ragel/content_disposition.rl View File

@@ -13,7 +13,7 @@
(((FWS? qcontent)* FWS?) >Quoted_Str_Start %Quoted_Str_End)
DQUOTE) CFWS?;
token = 0x21..0x27 | 0x2a..0x2b | 0x2c..0x2e | 0x30..0x39 | 0x41..0x5a | 0x5e..0x7e;
value = (quoted_string | (token -- '"' | 0x3d)+) >Param_Value_Start %Param_Value_End;
value = (quoted_string | (token -- '"' | 0x3d | utf8_2c | utf8_3c | utf8_4c)+) >Param_Value_Start %Param_Value_End;
attribute = (quoted_string | (token -- '"' | 0x3d)+) >Param_Name_Start %Param_Name_End;
parameter = CFWS? attribute FWS? "=" FWS? value CFWS?;


+ 2
- 1
src/ragel/content_disposition_parser.rl View File

@@ -1,5 +1,6 @@
%%{
machine content_type_parser;
alphtype unsigned char;

action Disposition_Start {
}
@@ -101,7 +102,7 @@
gboolean
rspamd_content_disposition_parser (const char *data, size_t len, struct rspamd_content_disposition *cd, rspamd_mempool_t *pool)
{
const char *p = data, *pe = data + len, *eof, *qstart = NULL, *qend = NULL,
const unsigned char *p = data, *pe = data + len, *eof, *qstart = NULL, *qend = NULL,
*pname_start = NULL, *pname_end = NULL, *pvalue_start = NULL, *pvalue_end = NULL;
int cs, *stack = NULL;
gsize top = 0;

Loading…
Cancel
Save