gfx/angle/src/compiler/preprocessor/64bit-tokenizer-safety.patch

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

michael@0 1 --- a/src/compiler/preprocessor/Tokenizer.cpp
michael@0 2 +++ b/src/compiler/preprocessor/Tokenizer.cpp
michael@0 3 @@ -56,6 +56,7 @@ typedef int16_t flex_int16_t;
michael@0 4 typedef uint16_t flex_uint16_t;
michael@0 5 typedef int32_t flex_int32_t;
michael@0 6 typedef uint32_t flex_uint32_t;
michael@0 7 +typedef uint64_t flex_uint64_t;
michael@0 8 #else
michael@0 9 typedef signed char flex_int8_t;
michael@0 10 typedef short int flex_int16_t;
michael@0 11 @@ -179,6 +180,11 @@ typedef void* yyscan_t;
michael@0 12 typedef struct yy_buffer_state *YY_BUFFER_STATE;
michael@0 13 #endif
michael@0 14
michael@0 15 +#ifndef YY_TYPEDEF_YY_SIZE_T
michael@0 16 +#define YY_TYPEDEF_YY_SIZE_T
michael@0 17 +typedef size_t yy_size_t;
michael@0 18 +#endif
michael@0 19 +
michael@0 20 #define EOB_ACT_CONTINUE_SCAN 0
michael@0 21 #define EOB_ACT_END_OF_FILE 1
michael@0 22 #define EOB_ACT_LAST_MATCH 2
michael@0 23 @@ -201,11 +207,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
michael@0 24
michael@0 25 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
michael@0 26
michael@0 27 -#ifndef YY_TYPEDEF_YY_SIZE_T
michael@0 28 -#define YY_TYPEDEF_YY_SIZE_T
michael@0 29 -typedef size_t yy_size_t;
michael@0 30 -#endif
michael@0 31 -
michael@0 32 #ifndef YY_STRUCT_YY_BUFFER_STATE
michael@0 33 #define YY_STRUCT_YY_BUFFER_STATE
michael@0 34 struct yy_buffer_state
michael@0 35 @@ -223,7 +224,7 @@ struct yy_buffer_state
michael@0 36 /* Number of characters read into yy_ch_buf, not including EOB
michael@0 37 * characters.
michael@0 38 */
michael@0 39 - int yy_n_chars;
michael@0 40 + yy_size_t yy_n_chars;
michael@0 41
michael@0 42 /* Whether we "own" the buffer - i.e., we know we created it,
michael@0 43 * and can realloc() it to grow it, and should free() it to
michael@0 44 @@ -302,7 +303,7 @@ static void pp_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
michael@0 45
michael@0 46 YY_BUFFER_STATE pp_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
michael@0 47 YY_BUFFER_STATE pp_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
michael@0 48 -YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
michael@0 49 +YY_BUFFER_STATE pp_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
michael@0 50
michael@0 51 void *ppalloc (yy_size_t ,yyscan_t yyscanner );
michael@0 52 void *pprealloc (void *,yy_size_t ,yyscan_t yyscanner );
michael@0 53 @@ -353,7 +354,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
michael@0 54 */
michael@0 55 #define YY_DO_BEFORE_ACTION \
michael@0 56 yyg->yytext_ptr = yy_bp; \
michael@0 57 - yyleng = (size_t) (yy_cp - yy_bp); \
michael@0 58 + yyleng = (yy_size_t) (yy_cp - yy_bp); \
michael@0 59 yyg->yy_hold_char = *yy_cp; \
michael@0 60 *yy_cp = '\0'; \
michael@0 61 yyg->yy_c_buf_p = yy_cp;
michael@0 62 @@ -579,8 +580,8 @@ struct yyguts_t
michael@0 63 size_t yy_buffer_stack_max; /**< capacity of stack. */
michael@0 64 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
michael@0 65 char yy_hold_char;
michael@0 66 - int yy_n_chars;
michael@0 67 - int yyleng_r;
michael@0 68 + yy_size_t yy_n_chars;
michael@0 69 + yy_size_t yyleng_r;
michael@0 70 char *yy_c_buf_p;
michael@0 71 int yy_init;
michael@0 72 int yy_start;
michael@0 73 @@ -637,7 +638,7 @@ FILE *ppget_out (yyscan_t yyscanner );
michael@0 74
michael@0 75 void ppset_out (FILE * out_str ,yyscan_t yyscanner );
michael@0 76
michael@0 77 -int ppget_leng (yyscan_t yyscanner );
michael@0 78 +yy_size_t ppget_leng (yyscan_t yyscanner );
michael@0 79
michael@0 80 char *ppget_text (yyscan_t yyscanner );
michael@0 81
michael@0 82 @@ -704,7 +705,7 @@ static int input (yyscan_t yyscanner );
michael@0 83 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
michael@0 84 { \
michael@0 85 int c = '*'; \
michael@0 86 - int n; \
michael@0 87 + yy_size_t n; \
michael@0 88 for ( n = 0; n < max_size && \
michael@0 89 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
michael@0 90 buf[n] = (char) c; \
michael@0 91 @@ -1338,7 +1339,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
michael@0 92
michael@0 93 else
michael@0 94 {
michael@0 95 - int num_to_read =
michael@0 96 + yy_size_t num_to_read =
michael@0 97 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
michael@0 98
michael@0 99 while ( num_to_read <= 0 )
michael@0 100 @@ -1352,7 +1353,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
michael@0 101
michael@0 102 if ( b->yy_is_our_buffer )
michael@0 103 {
michael@0 104 - int new_size = b->yy_buf_size * 2;
michael@0 105 + yy_size_t new_size = b->yy_buf_size * 2;
michael@0 106
michael@0 107 if ( new_size <= 0 )
michael@0 108 b->yy_buf_size += b->yy_buf_size / 8;
michael@0 109 @@ -1383,7 +1384,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
michael@0 110
michael@0 111 /* Read in more data. */
michael@0 112 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
michael@0 113 - yyg->yy_n_chars, (size_t) num_to_read );
michael@0 114 + yyg->yy_n_chars, num_to_read );
michael@0 115
michael@0 116 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
michael@0 117 }
michael@0 118 @@ -1508,7 +1509,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
michael@0 119
michael@0 120 else
michael@0 121 { /* need more input */
michael@0 122 - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
michael@0 123 + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
michael@0 124 ++yyg->yy_c_buf_p;
michael@0 125
michael@0 126 switch ( yy_get_next_buffer( yyscanner ) )
michael@0 127 @@ -1788,7 +1789,7 @@ void pppop_buffer_state (yyscan_t yyscanner)
michael@0 128 */
michael@0 129 static void ppensure_buffer_stack (yyscan_t yyscanner)
michael@0 130 {
michael@0 131 - int num_to_alloc;
michael@0 132 + yy_size_t num_to_alloc;
michael@0 133 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
michael@0 134
michael@0 135 if (!yyg->yy_buffer_stack) {
michael@0 136 @@ -1886,12 +1887,11 @@ YY_BUFFER_STATE pp_scan_string (yyconst char * yystr , yyscan_t yyscanner)
michael@0 137 * @param yyscanner The scanner object.
michael@0 138 * @return the newly allocated buffer state object.
michael@0 139 */
michael@0 140 -YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
michael@0 141 +YY_BUFFER_STATE pp_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
michael@0 142 {
michael@0 143 YY_BUFFER_STATE b;
michael@0 144 char *buf;
michael@0 145 - yy_size_t n;
michael@0 146 - int i;
michael@0 147 + yy_size_t n, i;
michael@0 148
michael@0 149 /* Get memory for full buffer, including space for trailing EOB's. */
michael@0 150 n = _yybytes_len + 2;
michael@0 151 @@ -2001,7 +2001,7 @@ FILE *ppget_out (yyscan_t yyscanner)
michael@0 152 /** Get the length of the current token.
michael@0 153 * @param yyscanner The scanner object.
michael@0 154 */
michael@0 155 -int ppget_leng (yyscan_t yyscanner)
michael@0 156 +yy_size_t ppget_leng (yyscan_t yyscanner)
michael@0 157 {
michael@0 158 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
michael@0 159 return yyleng;

mercurial