• Jon Olav Hauglid's avatar
    Bug #57659 Segfault in Query_cache::invalidate_data for TRUNCATE TABLE · 97e295cc
    Jon Olav Hauglid authored
    This crash could happen if TRUNCATE TABLE indirectly failed to open a
    merge table due to failures to open underlying tables. Even if opening
    failed, the TRUNCATE TABLE code would try to invalidate the table in
    the query cache. Since this table had been closed and memory released,
    this could lead to a crash.
    
    This bug was introduced by a combination of the changes introduced by
    the patch for Bug#52044, where failing to open a table will cause opened
    tables to be closed. And the changes in patch for Bug#49938, where
    TRUNCATE TABLE uses the standard open tables function.
    
    This patch fixes the problem by setting the TABLE pointer to NULL before 
    invalidating the query cache.
    
    Test case added to truncate_coverage.test.
    97e295cc
truncate_coverage.result 2.43 KB