Bug #37654 lex backup_compression not being set when no compression
Submitted: 26 Jun 2008 5:39 Modified: 21 Jul 2008 17:04
Reporter: Stewart Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:6.0 OS:Any
Assigned to: Stewart Smith CPU Architecture:Any

[26 Jun 2008 5:39] Stewart Smith
Description:
==32438== Conditional jump or move depends on uninitialised value(s)
==32438==    at 0x93991A: backup::Output_stream::open() (stream.cc:345)
==32438==    by 0x926D51: Backup_restore_ctx::prepare_for_backup(st_mysql_lex_string, char const*, bool, st_mysql_lex_string, unsigned long, st_mysql_lex_string, st_mysql_lex_string) (kernel.cc:569)
==32438==    by 0x92792D: execute_backup_command(THD*, st_lex*) (kernel.cc:155)
==32438==    by 0x6D2940: mysql_execute_command(THD*) (sql_parse.cc:2175)
==32438==    by 0x6DAD65: mysql_parse(THD*, char const*, unsigned, char const**) (sql_parse.cc:5794)
==32438==    by 0x6DB9D7: dispatch_command(enum_server_command, THD*, char*, unsigned) (sql_parse.cc:1058)
==32438==    by 0x6DCF17: do_command(THD*) (sql_parse.cc:731)
==32438==    by 0x6CA52D: handle_one_connection (sql_connect.cc:1134)
==32438==    by 0x4E2D3F6: start_thread (pthread_create.c:297)
==32438==    by 0x6329B2C: clone (in /usr/lib/debug/libc-2.7.so)

How to repeat:
BACKUP without compression enabled

Suggested fix:
sql_yacc.yy

opt_compression:
          /* empty */ {}
        | WITH COMPRESSION_SYM opt_compression_algorithm
          {
            Lex->backup_compression= true;
          }
        ;

add =false to other case
[18 Jul 2008 1:58] Marc ALFF
The fix is:

opt_compression:
          /* empty */ { Lex->backup_compression= false; }
        | WITH COMPRESSION_SYM opt_compression_algorithm
          {
            Lex->backup_compression= true;
          }
        ;

and is approved.
[21 Jul 2008 17:04] Paul DuBois
Noted in 6.0.7 changelog.

For BACKUP DATABASE, if the WITH COMPRESSION clause was not used, a
server crash resulted due to an uninitialized variable.
[21 Jul 2008 17:08] Paul DuBois
Modified changelog entry:

For BACKUP DATABASE, if the WITH COMPRESSION clause was not used, an
uninitialized variable could cause unpredictable results.