1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/compiler/64bit-lexer-safety.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,177 @@ 1.4 +--- a/src/compiler/glslang_lex.cpp 1.5 ++++ b/src/compiler/glslang_lex.cpp 1.6 +@@ -68,6 +68,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 +@@ -191,6 +192,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 +@@ -204,7 +210,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; 1.27 + */ 1.28 + #define YY_LESS_LINENO(n) \ 1.29 + do { \ 1.30 +- int yyl;\ 1.31 ++ yy_size_t yyl;\ 1.32 + for ( yyl = n; yyl < yyleng; ++yyl )\ 1.33 + if ( yytext[yyl] == '\n' )\ 1.34 + --yylineno;\ 1.35 +@@ -226,11 +232,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; 1.36 + 1.37 + #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) 1.38 + 1.39 +-#ifndef YY_TYPEDEF_YY_SIZE_T 1.40 +-#define YY_TYPEDEF_YY_SIZE_T 1.41 +-typedef size_t yy_size_t; 1.42 +-#endif 1.43 +- 1.44 + #ifndef YY_STRUCT_YY_BUFFER_STATE 1.45 + #define YY_STRUCT_YY_BUFFER_STATE 1.46 + struct yy_buffer_state 1.47 +@@ -248,7 +249,7 @@ struct yy_buffer_state 1.48 + /* Number of characters read into yy_ch_buf, not including EOB 1.49 + * characters. 1.50 + */ 1.51 +- int yy_n_chars; 1.52 ++ yy_size_t yy_n_chars; 1.53 + 1.54 + /* Whether we "own" the buffer - i.e., we know we created it, 1.55 + * and can realloc() it to grow it, and should free() it to 1.56 +@@ -327,7 +328,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); 1.57 + 1.58 + YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); 1.59 + YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); 1.60 +-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); 1.61 ++YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); 1.62 + 1.63 + void *yyalloc (yy_size_t ,yyscan_t yyscanner ); 1.64 + void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); 1.65 +@@ -378,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); 1.66 + */ 1.67 + #define YY_DO_BEFORE_ACTION \ 1.68 + yyg->yytext_ptr = yy_bp; \ 1.69 +- yyleng = (size_t) (yy_cp - yy_bp); \ 1.70 ++ yyleng = (yy_size_t) (yy_cp - yy_bp); \ 1.71 + yyg->yy_hold_char = *yy_cp; \ 1.72 + *yy_cp = '\0'; \ 1.73 + yyg->yy_c_buf_p = yy_cp; 1.74 +@@ -1035,8 +1036,8 @@ struct yyguts_t 1.75 + size_t yy_buffer_stack_max; /**< capacity of stack. */ 1.76 + YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ 1.77 + char yy_hold_char; 1.78 +- int yy_n_chars; 1.79 +- int yyleng_r; 1.80 ++ yy_size_t yy_n_chars; 1.81 ++ yy_size_t yyleng_r; 1.82 + char *yy_c_buf_p; 1.83 + int yy_init; 1.84 + int yy_start; 1.85 +@@ -1089,7 +1090,7 @@ FILE *yyget_out (yyscan_t yyscanner ); 1.86 + 1.87 + void yyset_out (FILE * out_str ,yyscan_t yyscanner ); 1.88 + 1.89 +-int yyget_leng (yyscan_t yyscanner ); 1.90 ++yy_size_t yyget_leng (yyscan_t yyscanner ); 1.91 + 1.92 + char *yyget_text (yyscan_t yyscanner ); 1.93 + 1.94 +@@ -1158,7 +1159,7 @@ static int input (yyscan_t yyscanner ); 1.95 + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 1.96 + { \ 1.97 + int c = '*'; \ 1.98 +- int n; \ 1.99 ++ yy_size_t n; \ 1.100 + for ( n = 0; n < max_size && \ 1.101 + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 1.102 + buf[n] = (char) c; \ 1.103 +@@ -1317,7 +1318,7 @@ yy_find_action: 1.104 + 1.105 + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) 1.106 + { 1.107 +- int yyl; 1.108 ++ yy_size_t yyl; 1.109 + for ( yyl = 0; yyl < yyleng; ++yyl ) 1.110 + if ( yytext[yyl] == '\n' ) 1.111 + 1.112 +@@ -2203,7 +2204,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.113 + 1.114 + else 1.115 + { 1.116 +- int num_to_read = 1.117 ++ yy_size_t num_to_read = 1.118 + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 1.119 + 1.120 + while ( num_to_read <= 0 ) 1.121 +@@ -2217,7 +2218,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.122 + 1.123 + if ( b->yy_is_our_buffer ) 1.124 + { 1.125 +- int new_size = b->yy_buf_size * 2; 1.126 ++ yy_size_t new_size = b->yy_buf_size * 2; 1.127 + 1.128 + if ( new_size <= 0 ) 1.129 + b->yy_buf_size += b->yy_buf_size / 8; 1.130 +@@ -2248,7 +2249,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.131 + 1.132 + /* Read in more data. */ 1.133 + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1.134 +- yyg->yy_n_chars, (size_t) num_to_read ); 1.135 ++ yyg->yy_n_chars, num_to_read ); 1.136 + 1.137 + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; 1.138 + } 1.139 +@@ -2373,7 +2374,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 1.140 + 1.141 + else 1.142 + { /* need more input */ 1.143 +- int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1.144 ++ yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; 1.145 + ++yyg->yy_c_buf_p; 1.146 + 1.147 + switch ( yy_get_next_buffer( yyscanner ) ) 1.148 +@@ -2660,7 +2661,7 @@ void yypop_buffer_state (yyscan_t yyscanner) 1.149 + */ 1.150 + static void yyensure_buffer_stack (yyscan_t yyscanner) 1.151 + { 1.152 +- int num_to_alloc; 1.153 ++ yy_size_t num_to_alloc; 1.154 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.155 + 1.156 + if (!yyg->yy_buffer_stack) { 1.157 +@@ -2758,12 +2759,11 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) 1.158 + * @param yyscanner The scanner object. 1.159 + * @return the newly allocated buffer state object. 1.160 + */ 1.161 +-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) 1.162 ++YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) 1.163 + { 1.164 + YY_BUFFER_STATE b; 1.165 + char *buf; 1.166 +- yy_size_t n; 1.167 +- int i; 1.168 ++ yy_size_t n, i; 1.169 + 1.170 + /* Get memory for full buffer, including space for trailing EOB's. */ 1.171 + n = _yybytes_len + 2; 1.172 +@@ -2913,7 +2913,7 @@ FILE *yyget_out (yyscan_t yyscanner) 1.173 + /** Get the length of the current token. 1.174 + * @param yyscanner The scanner object. 1.175 + */ 1.176 +-int yyget_leng (yyscan_t yyscanner) 1.177 ++yy_size_t yyget_leng (yyscan_t yyscanner) 1.178 + { 1.179 + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 1.180 + return yyleng;