Bug #68291 Plugins cannot set ulonglong vars to values larger than signed longlong max
Submitted: 6 Feb 2013 12:56 Modified: 18 Apr 2015 22:06
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Storage Engine API Severity:S3 (Non-critical)
Version:5.5, 5.6 OS:Any
Assigned to: CPU Architecture:Any

[6 Feb 2013 12:56] Laurynas Biveinis
Description:
Say one has

static MYSQL_SYSVAR_ULONGLONG(var, foo,
    PLUGIN_VAR_RQCMDARG,
    "Blah",
    NULL, NULL, 100*1024*1024ULL, 4096ULL, ULONGLONG_MAX, 0);

It sets on the running server to ULONGLONG_MAX just fine:

SET @@global.plugin_var = 18446744073709551615;
SELECT @@global.plugin_var;
18446744073709551615

But if one attempts to set it on the command line:
--plugin-var=18446744073709551615
...
30131 18:48:20 [ERROR] Incorrect integer value: '18446744073709551615'
...
Error while setting value '18446744073709551615' to 'plugin-var'

The cause is that getopt_ull() calls eval_num_suffix() which in turn calls strtoll(). Which should be strtoull() in this case instead.

How to repeat:
See above.

Suggested fix:
Adjust eval_num_suffix() to use strtoll() or strtoull() depending on whether the option is signed.
[8 Feb 2013 12:21] Erlend Dahl
Thank you for the bug report. We will take a closer look at this.
[27 Feb 2014 12:28] Laurynas Biveinis
bug 71852
[18 Apr 2015 22:06] Laurynas Biveinis
Was this fixed by the following?

$ git show -s cac6fc8
commit cac6fc837a5f72203058e4acc6b8b4dba8a98294
Author: V S Murthy Sidagam <venkata.sidagam@oracle.com>
Date:   Wed Jan 7 15:10:05 2015 +0530

    Description: According to the manual, the maximum value for group_concat_max_len in 64bit
    mysqld is 18446744073709547520. This works fine when set dynamically in the
    mysql command prompt. However, if the value is set in my.cnf, mysqld will refuse to honor
    and will not start up.
    
    Analysis: When the option group_concat_max_len is parsed and tries to store the given value,
    it will call eval_num_suffix() to convert the given value string to numeric value with the
    string function strtoll(). Since the give value won't fit in the longlong type an error is
    thrown and server refuse to start.
    
    Fix: As a fix we need to use strtoull() instead of strtoll(). which can accumulate the given
    unsigned longlong value.
    
    Note: This bug is already fixed in mysql-5.7 under bug #16491145. Hence used the same code changes to fix this bug as well.