1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/preprocessor/64bit-tokenizer-safety.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,159 @@ 1.4 +--- a/src/compiler/preprocessor/Tokenizer.cpp 1.5 ++++ b/src/compiler/preprocessor/Tokenizer.cpp 1.6 +@@ -56,6 +56,7 @@ typedef int16_t flex_int16_t; 1.7 + typedef uint16_t flex_uint16_t; 1.8 + typedef int32_t flex_int32_t; 1.9 + typedef uint32_t flex_uint32_t; 1.10 ++typedef uint64_t flex_uint64_t; 1.11 + #else 1.12 + typedef signed char flex_int8_t; 1.13 + typedef short int flex_int16_t; 1.14 +@@ -179,6 +180,11 @@ typedef void* yyscan_t; 1.15 + typedef struct yy_buffer_state *YY_BUFFER_STATE; 1.16 + #endif 1.17 + 1.18 ++#ifndef YY_TYPEDEF_YY_SIZE_T 1.19 ++#define YY_TYPEDEF_YY_SIZE_T 1.20 ++typedef size_t yy_size_t; 1.21 ++#endif 1.22 ++ 1.23 + #define EOB_ACT_CONTINUE_SCAN 0 1.24 + #define EOB_ACT_END_OF_FILE 1 1.25 + #define EOB_ACT_LAST_MATCH 2 1.26 +@@ -201,11 +207,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; 1.27 + 1.28 + #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 1.29 + 1.30 +-#ifndef YY_TYPEDEF_YY_SIZE_T 1.31 +-#define YY_TYPEDEF_YY_SIZE_T 1.32 +-typedef size_t yy_size_t; 1.33 +-#endif 1.34 +- 1.35 + #ifndef YY_STRUCT_YY_BUFFER_STATE 1.36 + #define YY_STRUCT_YY_BUFFER_STATE 1.37 + struct yy_buffer_state 1.38 +@@ -223,7 +224,7 @@ struct yy_buffer_state 1.39 + /* Number of characters read into yy_ch_buf, not including EOB 1.40 + * characters. 1.41 + */ 1.42 +- int yy_n_chars; 1.43 ++ yy_size_t yy_n_chars; 1.44 + 1.45 + /* Whether we "own" the buffer - i.e., we know we created it, 1.46 + * and can realloc() it to grow it, and should free() it to 1.47 +@@ -302,7 +303,7 @@ static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 1.48 + 1.49 + YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 1.50 + YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 1.51 +-YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 1.52 ++YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); 1.53 + 1.54 + void *ppalloc (yy_size_t ,yyscan_t yyscanner ); 1.55 + void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner ); 1.56 +@@ -353,7 +354,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 1.57 + */ 1.58 + #define YY_DO_BEFORE_ACTION \ 1.59 + yyg->yytext_ptr = yy_bp; \ 1.60 +- yyleng = (size_t) (yy_cp - yy_bp); \ 1.61 ++ yyleng = (yy_size_t) (yy_cp - yy_bp); \ 1.62 + yyg->yy_hold_char = *yy_cp; \ 1.63 + *yy_cp = '\0'; \ 1.64 + yyg->yy_c_buf_p = yy_cp; 1.65 +@@ -579,8 +580,8 @@ struct yyguts_t 1.66 + size_t yy_buffer_stack_max; /**< capacity of stack. */ 1.67 + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 1.68 + char yy_hold_char; 1.69 +- int yy_n_chars; 1.70 +- int yyleng_r; 1.71 ++ yy_size_t yy_n_chars; 1.72 ++ yy_size_t yyleng_r; 1.73 + char *yy_c_buf_p; 1.74 + int yy_init; 1.75 + int yy_start; 1.76 +@@ -637,7 +638,7 @@ FILE *ppget_out (yyscan_t yyscanner ); 1.77 + 1.78 + void ppset_out (FILE * out_str ,yyscan_t yyscanner ); 1.79 + 1.80 +-int ppget_leng (yyscan_t yyscanner ); 1.81 ++yy_size_t ppget_leng (yyscan_t yyscanner ); 1.82 + 1.83 + char *ppget_text (yyscan_t yyscanner ); 1.84 + 1.85 +@@ -704,7 +705,7 @@ static int input (yyscan_t yyscanner ); 1.86 + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 1.87 + { \ 1.88 + int c = '*'; \ 1.89 +- int n; \ 1.90 ++ yy_size_t n; \ 1.91 + for ( n = 0; n < max_size && \ 1.92 + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 1.93 + buf[n] = (char) c; \ 1.94 +@@ -1338,7 +1339,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.95 + 1.96 + else 1.97 + { 1.98 +- int num_to_read = 1.99 ++ yy_size_t num_to_read = 1.100 + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1.101 + 1.102 + while ( num_to_read <= 0 ) 1.103 +@@ -1352,7 +1353,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.104 + 1.105 + if ( b->yy_is_our_buffer ) 1.106 + { 1.107 +- int new_size = b->yy_buf_size * 2; 1.108 ++ yy_size_t new_size = b->yy_buf_size * 2; 1.109 + 1.110 + if ( new_size <= 0 ) 1.111 + b->yy_buf_size += b->yy_buf_size / 8; 1.112 +@@ -1383,7 +1384,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.113 + 1.114 + /* Read in more data. */ 1.115 + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1.116 +- yyg->yy_n_chars, (size_t) num_to_read ); 1.117 ++ yyg->yy_n_chars, num_to_read ); 1.118 + 1.119 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1.120 + } 1.121 +@@ -1508,7 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.122 + 1.123 + else 1.124 + { /* need more input */ 1.125 +- int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1.126 ++ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1.127 + ++yyg->yy_c_buf_p; 1.128 + 1.129 + switch ( yy_get_next_buffer( yyscanner ) ) 1.130 +@@ -1788,7 +1789,7 @@ void pppop_buffer_state (yyscan_t yyscanner) 1.131 + */ 1.132 + static void ppensure_buffer_stack (yyscan_t yyscanner) 1.133 + { 1.134 +- int num_to_alloc; 1.135 ++ yy_size_t num_to_alloc; 1.136 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.137 + 1.138 + if (!yyg->yy_buffer_stack) { 1.139 +@@ -1886,12 +1887,11 @@ YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner) 1.140 + * @param yyscanner The scanner object. 1.141 + * @return the newly allocated buffer state object. 1.142 + */ 1.143 +-YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) 1.144 ++YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) 1.145 + { 1.146 + YY_BUFFER_STATE b; 1.147 + char *buf; 1.148 +- yy_size_t n; 1.149 +- int i; 1.150 ++ yy_size_t n, i; 1.151 + 1.152 + /* Get memory for full buffer, including space for trailing EOB's. */ 1.153 + n = _yybytes_len + 2; 1.154 +@@ -2001,7 +2001,7 @@ FILE *ppget_out (yyscan_t yyscanner) 1.155 + /** Get the length of the current token. 1.156 + * @param yyscanner The scanner object. 1.157 + */ 1.158 +-int ppget_leng (yyscan_t yyscanner) 1.159 ++yy_size_t ppget_leng (yyscan_t yyscanner) 1.160 + { 1.161 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.162 + return yyleng;