• Sujatha's avatar
    MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in... · eef4c5d3
    Sujatha authored
    MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in instrings/strmake.c:36 from change_master (on optimized builds)
    
    Problem:
    ========
    CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='',
      MASTER_SSL_CERT='', MASTER_SSL_KEY='', MASTER_SSL_CRL='',
      MASTER_SSL_CRLPATH='';
    
    CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
    
    use-after-poison is reported for lex_mi->ssl_crl
    
    File: sql_repl.cc
    
    if (lex_mi->ssl_crl)
      strmake_buf(mi->ssl_crl, lex_mi->ssl_crl);
    
    Analysis:
    ========
    At the end of CHANGE MASTER statement execution, the LEX_MASTER_INFO
    parameters are reset so that the next query will have a clean state. But
    'ssl_crl' and 'ssl_crl_path' members of LEX_MASTER_INFO object are not
    cleared during 'LEX_MASTER_INFO::reset'. Hence when a new CHANGE MASTER
    statement is executed, the stale value of lex_mi->ssl_crl is used, so ASAN
    reports use-after-poison.
    
    Fix:
    ===
    Clear 'ssl_crl' and 'ssl_crl_path' as part of 'reset'.
    eef4c5d3
sql_lex.h 102 KB