• Sergey Glukhov's avatar
    Bug#45195 valgrind warnings about uninitialized values in store_record_in_cache() · 0752d62f
    Sergey Glukhov authored
    The problem becomes apparent only if HAVE_purify is undefined.
    It related to the part of code placed in open_table_from_share() fuction
    where we initialize record buffer only if HAVE_purify is enabled.
    So in case of HAVE_purify=OFF record buffer is not initialized
    on open table stage.
    Next we read key, find NULL value and update appropriate null bit
    but do not update record buffer. After that the record is stored
    in the join cache(store_record_in_cache). For CHAR fields we
    strip trailing spaces and in our case this procedure uses
    uninitialized record buffer.
    The fix is to skip stripping space procedure in case of null values
    for CHAR fields(partially based on 6.0 JOIN_CACHE implementation).
    
    
    mysql-test/r/join.result:
      test case
    mysql-test/t/join.test:
      test case
    sql/field.cc:
      code updated according to new CACHE_FIELD struct
    sql/sql_select.cc:
      code updated according to new CACHE_FIELD struct
    sql/sql_select.h:
      CACHE_FIELD struct:
      added new fields: Field *field, uint type;
      removed fields: Field_blob *blob_field, bool strip;
    0752d62f
sql_select.cc 541 KB