(you don't have to strictly follow this form)

**Describe the bug**
A link to the report: https://s3.amazonaws.com/clickhouse-test-reports/35466/d81c58b5d9be45ac69c3859b5cbe97080711f6d9/fuzzer_astfuzzerubsan,actions//report.html
The commit: https://github.com/ClickHouse/ClickHouse/commit/d81c58b5d9be45ac69c3859b5cbe97080711f6d9
if (!metadata_snapshot)
            metadata_snapshot = storage->getInMemoryMetadataPtr();
        storage_snapshot = storage->getStorageSnapshotForQuery(metadata_snapshot, query_ptr);
    }
    if (has_input || !joined_tables.resolveTables())
        joined_tables.makeFakeTable(storage, metadata_snapshot, source_header);
    
    if (!has_input && joined_tables.tablesCount() > 1)
    {
        rewriteMultipleJoins(query_ptr, joined_tables.tablesWithColumns(), context->getCurrentDatabase(), context->getSettingsRef());
        joined_tables.reset(getSelectQuery());
        joined_tables.resolveTables();
        if (auto view_source = context->getViewSource())
        {
            
            
            const auto & storage_values = static_cast<const StorageValues &>(*view_source);
            auto tmp_table_id = storage_values.getStorageID();
            for (const auto & t : joined_tables.tablesWithColumns())
                uses_view_source |= (t.table.database == tmp_table_id.database_name && t.table.table == tmp_table_id.table_name);
        }
        if (storage && joined_tables.isLeftTableSubquery())
        {
            
            storage = nullptr;
            table_lock.reset();
            table_id = StorageID::createEmpty();
            metadata_snapshot = nullptr;
        }
    }