Skip to content

Commit

Permalink
Bison 3.7 - fix "conversion from 'ptrdiff_t' to 'ulong', possible los…
Browse files Browse the repository at this point in the history
…s of data"
  • Loading branch information
vaintroub committed Sep 11, 2021
1 parent 879e21b commit 3504f70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7226,10 +7226,10 @@ bool check_stack_overrun(THD *thd, long margin,
#define MY_YACC_INIT 1000 // Start with big alloc
#define MY_YACC_MAX 32000 // Because of 'short'

bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, size_t *yystacksize)
{
Yacc_state *state= & current_thd->m_parser_state->m_yacc;
ulong old_info=0;
size_t old_info=0;
DBUG_ASSERT(state);
if ((uint) *yystacksize >= MY_YACC_MAX)
return 1;
Expand Down
4 changes: 2 additions & 2 deletions sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int yylex(void *yylval, void *yythd);

#define yyoverflow(A,B,C,D,E,F) \
{ \
ulong val= *(F); \
size_t val= *(F); \
if (my_yyoverflow((B), (D), &val)) \
{ \
yyerror(thd, (char*) (A)); \
Expand Down Expand Up @@ -1024,7 +1024,7 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr)
}

%{
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%}

%pure-parser /* We have threads */
Expand Down

0 comments on commit 3504f70

Please sign in to comment.