thanks for review!
Alexander Nozdrin wrote:
> Hi Alexander,
> thank you for working on this.
> As discussed on IRC, that function actually has another bug --
> the function returns (number_of_decimals + 1) instead
> of number_of_decimals.
> The thing is that the function is not really used to return number
> of decimals (lol!), that's why this bug is not visible.
> Although it seems pretty safe to fix also that new bug,
> it's proposed to leave it as it is because of 5.5 nature.
> However, could you please
> 1) Report a new bug about that issue
> 2) Put a comment in the code about that flaw
I added a comment about this flaw:
+ The number of decimal digist in fact should be (str - decimal_point
+ But it seems the result of nr_of_decimals() is never used!
+ In case of 'e' and 'E' nr_of_decimals returns NOT_FIXED_DEC.
+ In case if there is no 'e' or 'E' parser code in sql_yacc.yy
+ never calls Item_float::Item_float() - it creates Item_decimal instead.
+ The only piece of code where we call Item_float::Item_float(str, len)
+ without having 'e' or 'E' is item_xmlfunc.cc, but this Item_float
+ never appears in metadata itself. Changing the code to return
+ (str - decimal_point - 1) does not make any changes in the test
+ This should be addressed somehow.
+ Looks like a reminder from before real DECIMAL times.
But I don't know if we really need to report it as a bug.
> Wrt Bug#58175 itself, I think the patch is Ok and can be pushed.
> On 18.11.2010 18:38, Alexander Barkov wrote:
>> #At file:///home/bar/mysql-bzr/mysql-5.5-bugteam.b58175/ based on
>> 3135 Alexander Barkov 2010-11-18
>> Bug#58175 xml functions read initialized bytes when conversions
>> nr_of_decimals could read behind the end of the buffer
>> in case of a non-null-terminated string, which caused
>> valgring warnings.
>> fixing nr_of_decimals not to read behind the "end" pointer.