**Describe the bug**
[A link to the report
](https://s3.amazonaws.com/clickhouse-test-reports/0/bef3c71453b14efc72e4b2ce37f2ec87f69b4e40/fuzzer_astfuzzerasan//report.html)
**How to reproduce**
```sql
select JSONExtract('{"a" : {"b" : {"c" : 1, "d" : "str"}}}', 'Tuple( a LowCardinality(String), b LowCardinality(String), c LowCardinality(String), d LowCardinality(String))')
```

```
2022.10.24 23:07:03.404418 [ 875356 ] {daaaee1e-142e-4792-b640-0381dd1c7b39} <Debug> executeQuery: (from [::ffff:127.0.0.1]:57844) select JSONExtract('{"a" : {"b" : {"c" : 1, "d" : "str"}}}', 'Tuple( a LowCardinality(String), b LowCardinality(String), c LowCardinality(String), d LowCardinality(String))') (stage: Complete)
2022.10.24 23:07:03.404876 [ 875349 ] {} <Trace> BaseDaemon: Received signal 11
2022.10.24 23:07:03.405132 [ 875639 ] {} <Fatal> BaseDaemon: ########################################
2022.10.24 23:07:03.405223 [ 875639 ] {} <Fatal> BaseDaemon: (version 22.10.1.1674 (official build), build id: 30C9EDE94CF3A917D6FB0B915707FA38D8271475) (from thread 875356) (query_id: daaaee1e-142e-4792-b640-0381dd1c7b39) (query: select JSONExtract('{"a" : {"b" : {"c" : 1, "d" : "str"}}}', 'Tuple( a LowCardinality(String), b LowCardinality(String), c LowCardinality(String), d LowCardinality(String))')) Received signal Segmentation fault (11)
2022.10.24 23:07:03.405275 [ 875639 ] {} <Fatal> BaseDaemon: Address: NULL pointer. Access: write. Address not mapped to object.
2022.10.24 23:07:03.405317 [ 875639 ] {} <Fatal> BaseDaemon: Stack trace: 0x88df8bb 0x88df3e9 0x88df0f2 0x88e73b7 0x88ebf1a 0x88e396b 0x7bf4b4a 0x1140dc31 0x1140d701 0x1140dbd5 0x1140e577 0x1140f868 0x11b00372 0x11fe3fad 0x11feea2f 0x11fe994a 0x11fec7d8 0x11fac95c 0x11fac6fe 0x11fbc745 0x11fc183d 0x124c1523 0x124b9c75 0x124b49c0 0x124ff382 0x124fd100 0x124736df 0x128035c0 0x12800ead 0x133c6084 0x133da079 0x161f05cf 0x161f295b 0x163ae1f2 0x163ab97d 0x7f8ad311d609 0x7f8ad3042163
2022.10.24 23:07:04.165660 [ 875639 ] {} <Fatal> BaseDaemon: 2. DB::writeChar(char, DB::WriteBuffer&) @ 0x88df8bb in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:04.903069 [ 875639 ] {} <Fatal> BaseDaemon: 3. DB::JSONExtractRawImpl<DB::SimdJSONParser>::traverse(DB::SimdJSONParser::Element const&, DB::WriteBuffer&) @ 0x88df3e9 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:05.639914 [ 875639 ] {} <Fatal> BaseDaemon: 4. DB::JSONExtractRawImpl<DB::SimdJSONParser>::insertResultToColumn(DB::IColumn&, DB::SimdJSONParser::Element const&, std::__1::basic_string_view<char, std::__1::char_traits<char> >) @ 0x88df0f2 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:06.376322 [ 875639 ] {} <Fatal> BaseDaemon: 5. DB::JSONExtractTree<DB::SimdJSONParser>::StringNode::insertResultToColumn(DB::IColumn&, DB::SimdJSONParser::Element const&) @ 0x88e73b7 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:07.113269 [ 875639 ] {} <Fatal> BaseDaemon: 6. DB::JSONExtractTree<DB::SimdJSONParser>::TupleNode::insertResultToColumn(DB::IColumn&, DB::SimdJSONParser::Element const&) @ 0x88ebf1a in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:07.849269 [ 875639 ] {} <Fatal> BaseDaemon: 7. DB::ExecutableFunctionJSON<DB::NameJSONExtract, DB::JSONExtractImpl>::executeImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x88e396b in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.586973 [ 875639 ] {} <Fatal> BaseDaemon: 8. DB::IExecutableFunction::executeDryRunImpl(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long) const @ 0x7bf4b4a in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.595447 [ 875639 ] {} <Fatal> BaseDaemon: 9. ./build_docker/../src/Functions/IFunction.cpp:0: DB::IExecutableFunction::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x1140dc31 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.602987 [ 875639 ] {} <Fatal> BaseDaemon: 10. ./build_docker/../src/Functions/IFunction.cpp:0: DB::IExecutableFunction::defaultImplementationForConstantArguments(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x1140d701 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.610610 [ 875639 ] {} <Fatal> BaseDaemon: 11. ./build_docker/../src/Functions/IFunction.cpp:0: DB::IExecutableFunction::executeWithoutLowCardinalityColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x1140dbd5 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.618604 [ 875639 ] {} <Fatal> BaseDaemon: 12.1. inlined from ./build_docker/../contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:115: intrusive_ptr
2022.10.24 23:07:08.618627 [ 875639 ] {} <Fatal> BaseDaemon: 12.2. inlined from ./build_docker/../contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:122: boost::intrusive_ptr<DB::IColumn const>::operator=(boost::intrusive_ptr<DB::IColumn const>&&)
2022.10.24 23:07:08.618645 [ 875639 ] {} <Fatal> BaseDaemon: 12.3. inlined from ./build_docker/../src/Common/COW.h:136: COW<DB::IColumn>::immutable_ptr<DB::IColumn>::operator=(COW<DB::IColumn>::immutable_ptr<DB::IColumn>&&)
2022.10.24 23:07:08.618679 [ 875639 ] {} <Fatal> BaseDaemon: 12. ./build_docker/../src/Functions/IFunction.cpp:302: DB::IExecutableFunction::executeWithoutSparseColumns(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x1140e577 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.627273 [ 875639 ] {} <Fatal> BaseDaemon: 13.1. inlined from ./build_docker/../contrib/libcxx/include/vector:399: ~vector
2022.10.24 23:07:08.627320 [ 875639 ] {} <Fatal> BaseDaemon: 13. ./build_docker/../src/Functions/IFunction.cpp:373: DB::IExecutableFunction::execute(std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> > const&, std::__1::shared_ptr<DB::IDataType const> const&, unsigned long, bool) const @ 0x1140f868 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.697731 [ 875639 ] {} <Fatal> BaseDaemon: 14. ./build_docker/../src/Interpreters/ActionsDAG.cpp:0: DB::ActionsDAG::addFunction(std::__1::shared_ptr<DB::IFunctionOverloadResolver> const&, std::__1::vector<DB::ActionsDAG::Node const*, std::__1::allocator<DB::ActionsDAG::Node const*> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) @ 0x11b00372 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.739921 [ 875639 ] {} <Fatal> BaseDaemon: 15. ./build_docker/../src/Interpreters/ActionsVisitor.cpp:0: DB::ScopeStack::addFunction(std::__1::shared_ptr<DB::IFunctionOverloadResolver> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) @ 0x11fe3fad in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.790495 [ 875639 ] {} <Fatal> BaseDaemon: 16.1. inlined from ./build_docker/../contrib/libcxx/include/string:1445: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const
2022.10.24 23:07:08.790519 [ 875639 ] {} <Fatal> BaseDaemon: 16.2. inlined from ./build_docker/../contrib/libcxx/include/string:2231: ~basic_string
2022.10.24 23:07:08.790533 [ 875639 ] {} <Fatal> BaseDaemon: 16. ./build_docker/../src/Interpreters/ActionsVisitor.h:182: DB::ActionsMatcher::Data::addFunction(std::__1::shared_ptr<DB::IFunctionOverloadResolver> const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) @ 0x11feea2f in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.834041 [ 875639 ] {} <Fatal> BaseDaemon: 17.1. inlined from ./build_docker/../contrib/libcxx/include/string:1445: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const
2022.10.24 23:07:08.834064 [ 875639 ] {} <Fatal> BaseDaemon: 17.2. inlined from ./build_docker/../contrib/libcxx/include/string:2231: ~basic_string
2022.10.24 23:07:08.834102 [ 875639 ] {} <Fatal> BaseDaemon: 17. ./build_docker/../src/Interpreters/ActionsVisitor.cpp:1296: DB::ActionsMatcher::visit(DB::ASTFunction const&, std::__1::shared_ptr<DB::IAST> const&, DB::ActionsMatcher::Data&) @ 0x11fe994a in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.880922 [ 875639 ] {} <Fatal> BaseDaemon: 18. ./build_docker/../src/Interpreters/ActionsVisitor.cpp:826: DB::ActionsMatcher::visit(DB::ASTExpressionList&, std::__1::shared_ptr<DB::IAST> const&, DB::ActionsMatcher::Data&) @ 0x11fec7d8 in /usr/lib/debug/usr/bin/clickhouse.debug
2022.10.24 23:07:08.917904 [ 875639 ] {} <Fatal> BaseDaemon: 19.1. inlined from ./build_docker/../contrib/libcxx/include/__memory/shared_ptr.h:816: std::__1::shared_ptr<DB::IAST>::operator->() const
2022.10.24 23:07:08.917931 [ 875639 ] {} <Fatal> BaseDaemon: 19.2. inlined from ./build_docker/../src/Interpreters/InDepthNodeVisitor.h:56: DB::InDepthNodeVisitor<DB::ActionsMatcher, true, false, std::__1::shared_ptr<DB::IAST> const>::visitChildren(std::__1::shared_ptr<DB::IAST> const&)
2022.10.24 23:07:08.917947 [ 875639 ] {} <Fatal> BaseDaemon: 19. ./build_docker/../src/Interpreters/InDepthNodeVisitor.h:46: DB::InDepthNodeVisitor<DB::ActionsMatcher, true, false, std::__1::shared_ptr<DB::IAST> const>::visit(std::__1::shared_ptr<DB::IAST> const&) @ 0x11fac95c in /usr/lib/debug/usr/bin/clickhouse.debug
```

col.insertDefault();
                    }
                }
            };
            if (element.isArray())
            {
                auto array = element.getArray();
                auto it = array.begin();
                for (size_t index = 0; (index != nested.size()) && (it != array.end()); ++index)
                {
                    if (nested[index]->insertResultToColumn(tuple.getColumn(index), *it++))
                        were_valid_elements = true;
                    else
                        tuple.getColumn(index).insertDefault();
                }
                set_size(old_size + static_cast<size_t>(were_valid_elements));
                return were_valid_elements;
            }
            if (element.isObject())
            {
                auto object = element.getObject();
                if (name_to_index_map.empty())
                {
                    auto it = object.begin();
                    for (size_t index = 0; (index != nested.size()) && (it != object.end()); ++index)
                    {
                        if (nested[index]->insertResultToColumn(tuple.getColumn(index), (*it++).second))
                            were_valid_elements = true;
                        else
                            tuple.getColumn(index).insertDefault();