• unknown's avatar
    Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused · 89cccc7c
    unknown authored
    server crash.
    
    The filesort implementation has an optimization for subquery execution which
    consists of reusing previously allocated buffers. In particular the call to
    the read_buffpek_from_file function might be skipped when a big enough buffer
    for buffer descriptors (buffpeks) is already allocated. Beside allocating
    memory for buffpeks this function fills allocated buffer with data read from
    disk. Skipping it might led to using an arbitrary memory as fields' data and
    finally to a crash.
    
    Now the read_buffpek_from_file function is always called. It allocates
    new buffer only when necessary, but always fill it with correct data.
    
    
    sql/filesort.cc:
      Bug#33675: Usage of an uninitialized memory by filesort in a subquery caused
      server crash.Now the read_buffpek_from_file function is always called. It allocates
      new buffer only when necessary, but always fill it with correct data.
    mysql-test/r/subselect.result:
      Added a test case for the bug#33675: Usage of an uninitialized memory by
      filesort in a subquery caused server crash.
    mysql-test/t/subselect.test:
      Added a test case for the bug#33675: Usage of an uninitialized memory by
      filesort in a subquery caused server crash.
    89cccc7c
filesort.cc 44.8 KB