gfx/angle/src/compiler/64bit-lexer-safety.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 --- a/src/compiler/glslang_lex.cpp
     2 +++ b/src/compiler/glslang_lex.cpp
     3 @@ -68,6 +68,7 @@ typedef int16_t flex_int16_t;
     4  typedef uint16_t flex_uint16_t;
     5  typedef int32_t flex_int32_t;
     6  typedef uint32_t flex_uint32_t;
     7 +typedef uint64_t flex_uint64_t;
     8  #else
     9  typedef signed char flex_int8_t;
    10  typedef short int flex_int16_t;
    11 @@ -191,6 +192,11 @@ typedef void* yyscan_t;
    12  typedef struct yy_buffer_state *YY_BUFFER_STATE;
    13  #endif
    15 +#ifndef YY_TYPEDEF_YY_SIZE_T
    16 +#define YY_TYPEDEF_YY_SIZE_T
    17 +typedef size_t yy_size_t;
    18 +#endif
    19 +
    20  #define EOB_ACT_CONTINUE_SCAN 0
    21  #define EOB_ACT_END_OF_FILE 1
    22  #define EOB_ACT_LAST_MATCH 2
    23 @@ -204,7 +210,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
    24       */
    25      #define  YY_LESS_LINENO(n) \
    26              do { \
    27 -                int yyl;\
    28 +                yy_size_t yyl;\
    29                  for ( yyl = n; yyl < yyleng; ++yyl )\
    30                      if ( yytext[yyl] == '\n' )\
    31                          --yylineno;\
    32 @@ -226,11 +232,6 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
    34  #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
    36 -#ifndef YY_TYPEDEF_YY_SIZE_T
    37 -#define YY_TYPEDEF_YY_SIZE_T
    38 -typedef size_t yy_size_t;
    39 -#endif
    40 -
    41  #ifndef YY_STRUCT_YY_BUFFER_STATE
    42  #define YY_STRUCT_YY_BUFFER_STATE
    43  struct yy_buffer_state
    44 @@ -248,7 +249,7 @@ struct yy_buffer_state
    45  	/* Number of characters read into yy_ch_buf, not including EOB
    46  	 * characters.
    47  	 */
    48 -	int yy_n_chars;
    49 +	yy_size_t yy_n_chars;
    51  	/* Whether we "own" the buffer - i.e., we know we created it,
    52  	 * and can realloc() it to grow it, and should free() it to
    53 @@ -327,7 +328,7 @@ static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
    55  YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
    56  YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
    57 -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
    58 +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
    60  void *yyalloc (yy_size_t ,yyscan_t yyscanner );
    61  void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
    62 @@ -378,7 +379,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
    63   */
    64  #define YY_DO_BEFORE_ACTION \
    65  	yyg->yytext_ptr = yy_bp; \
    66 -	yyleng = (size_t) (yy_cp - yy_bp); \
    67 +	yyleng = (yy_size_t) (yy_cp - yy_bp); \
    68  	yyg->yy_hold_char = *yy_cp; \
    69  	*yy_cp = '\0'; \
    70  	yyg->yy_c_buf_p = yy_cp;
    71 @@ -1035,8 +1036,8 @@ struct yyguts_t
    72      size_t yy_buffer_stack_max; /**< capacity of stack. */
    73      YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
    74      char yy_hold_char;
    75 -    int yy_n_chars;
    76 -    int yyleng_r;
    77 +    yy_size_t yy_n_chars;
    78 +    yy_size_t yyleng_r;
    79      char *yy_c_buf_p;
    80      int yy_init;
    81      int yy_start;
    82 @@ -1089,7 +1090,7 @@ FILE *yyget_out (yyscan_t yyscanner );
    84  void yyset_out  (FILE * out_str ,yyscan_t yyscanner );
    86 -int yyget_leng (yyscan_t yyscanner );
    87 +yy_size_t yyget_leng (yyscan_t yyscanner );
    89  char *yyget_text (yyscan_t yyscanner );
    91 @@ -1158,7 +1159,7 @@ static int input (yyscan_t yyscanner );
    92  	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
    93  		{ \
    94  		int c = '*'; \
    95 -		int n; \
    96 +		yy_size_t n; \
    97  		for ( n = 0; n < max_size && \
    98  			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
    99  			buf[n] = (char) c; \
   100 @@ -1317,7 +1318,7 @@ yy_find_action:
   102  		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
   103  			{
   104 -			int yyl;
   105 +			yy_size_t yyl;
   106  			for ( yyl = 0; yyl < yyleng; ++yyl )
   107  				if ( yytext[yyl] == '\n' )
   109 @@ -2203,7 +2204,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   111  	else
   112  		{
   113 -			int num_to_read =
   114 +			yy_size_t num_to_read =
   115  			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
   117  		while ( num_to_read <= 0 )
   118 @@ -2217,7 +2218,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   120  			if ( b->yy_is_our_buffer )
   121  				{
   122 -				int new_size = b->yy_buf_size * 2;
   123 +				yy_size_t new_size = b->yy_buf_size * 2;
   125  				if ( new_size <= 0 )
   126  					b->yy_buf_size += b->yy_buf_size / 8;
   127 @@ -2248,7 +2249,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   129  		/* Read in more data. */
   130  		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
   131 -			yyg->yy_n_chars, (size_t) num_to_read );
   132 +			yyg->yy_n_chars, num_to_read );
   134  		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
   135  		}
   136 @@ -2373,7 +2374,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
   138  		else
   139  			{ /* need more input */
   140 -			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
   141 +			yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
   142  			++yyg->yy_c_buf_p;
   144  			switch ( yy_get_next_buffer( yyscanner ) )
   145 @@ -2660,7 +2661,7 @@ void yypop_buffer_state (yyscan_t yyscanner)
   146   */
   147  static void yyensure_buffer_stack (yyscan_t yyscanner)
   148  {
   149 -	int num_to_alloc;
   150 +	yy_size_t num_to_alloc;
   151      struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   153  	if (!yyg->yy_buffer_stack) {
   154 @@ -2758,12 +2759,11 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
   155   * @param yyscanner The scanner object.
   156   * @return the newly allocated buffer state object.
   157   */
   158 -YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
   159 +YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len , yyscan_t yyscanner)
   160  {
   161  	YY_BUFFER_STATE b;
   162  	char *buf;
   163 -	yy_size_t n;
   164 -	int i;
   165 +	yy_size_t n, i;
   167  	/* Get memory for full buffer, including space for trailing EOB's. */
   168  	n = _yybytes_len + 2;
   169 @@ -2913,7 +2913,7 @@ FILE *yyget_out  (yyscan_t yyscanner)
   170  /** Get the length of the current token.
   171   * @param yyscanner The scanner object.
   172   */
   173 -int yyget_leng  (yyscan_t yyscanner)
   174 +yy_size_t yyget_leng  (yyscan_t yyscanner)
   175  {
   176      struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
   177      return yyleng;

mercurial