Commit b079b388 authored by Tor Didriksen's avatar Tor Didriksen

Backport

Bug #11764313 57135: CRASH IN ITEM_FUNC_CASE::FIND_ITEM WITH CASE WHEN
Bug #11764818 57692: Crash in item_func_in::val_int() with ZEROFILL
parent 66c7b315
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -3045,6 +3045,15 @@ void Item_func_case::fix_length_and_dec() ...@@ -3045,6 +3045,15 @@ void Item_func_case::fix_length_and_dec()
return; return;
} }
} }
/*
Set cmp_context of all WHEN arguments. This prevents
Item_field::equal_fields_propagator() from transforming a
zerofill argument into a string constant. Such a change would
require rebuilding cmp_items.
*/
for (i= 0; i < ncases; i+= 2)
args[i]->cmp_context= item_cmp_type(left_result_type,
args[i]->result_type());
} }
if (else_expr_num == -1 || args[else_expr_num]->maybe_null) if (else_expr_num == -1 || args[else_expr_num]->maybe_null)
...@@ -4032,6 +4041,16 @@ void Item_func_in::fix_length_and_dec() ...@@ -4032,6 +4041,16 @@ void Item_func_in::fix_length_and_dec()
} }
} }
} }
/*
Set cmp_context of all arguments. This prevents
Item_field::equal_fields_propagator() from transforming a zerofill integer
argument into a string constant. Such a change would require rebuilding
cmp_itmes.
*/
for (arg= args + 1, arg_end= args + arg_count; arg != arg_end ; arg++)
{
arg[0]->cmp_context= item_cmp_type(left_result_type, arg[0]->result_type());
}
max_length= 1; max_length= 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment