Skip to content

INTERNAL Error: Attempted to access index 4 within vector of size 4 #4234

@fuzzerofducks

Description

@fuzzerofducks

Issue found by csv_multi_param_fuzzer on git commit hash 76a33 using seed 0.

To Reproduce

.sh wget https://github.com/duckdb/duckdb-fuzzer/raw/refs/heads/main/reproduction_inputs/csv/20251001_a7c625.csv
from read_csv('20251001_a7c625.csv', buffer_size=30, delim=';', header=false, null_padding=true, union_by_name=false);

Error Message

INTERNAL Error: Attempted to access index 4 within vector of size 4

Stack Trace


0        Exception::Exception(ExceptionType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 64
1        InternalException::InternalException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 20
2        InternalException::InternalException<unsigned long long, unsigned long long>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unsigned long long, unsigned long long) + 140
3        vector<Vector, true>::operator[](unsigned long) + 180
4        StringValueScanner::ProcessOverBufferValue() + 1344
5        StringValueScanner::MoveToNextBuffer() + 444
6        StringValueScanner::FinalizeChunkProcess() + 376
7        StringValueScanner::ParseChunk() + 128
8        CSVSniffer::DetectTypes() + 328
9        CSVSniffer::SniffCSV(bool) + 136
10       CSVSchemaDiscovery::SchemaDiscovery(ClientContext&, shared_ptr<CSVBufferManager, true>&, CSVReaderOptions&, MultiFileOptions const&, vector<LogicalType, true>&, vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, true>&, MultiFileList&) + 440
11       CSVMultiFileInfo::BindReader(ClientContext&, vector<LogicalType, true>&, vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, true>&, MultiFileBindData&) + 316
12       MultiFileFunction<CSVMultiFileInfo>::MultiFileBindInternal(ClientContext&, unique_ptr<MultiFileReader, std::__1::default_delete<MultiFileReader>, true>, shared_ptr<MultiFileList, true>, vector<LogicalType, true>&, vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, true>&, MultiFileOptions, unique_ptr<BaseFileReaderOptions, std::__1::default_delete<BaseFileReaderOptions>, true>, unique_ptr<MultiFileReaderInterface, std::__1::default_delete<MultiFileReaderInterface>, true>) + 1000
13       MultiFileFunction<CSVMultiFileInfo>::MultiFileBind(ClientContext&, TableFunctionBindInput&, vector<LogicalType, true>&, vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, true>&) + 828
14       Binder::BindTableFunctionInternal(TableFunction&, TableFunctionRef const&, vector<Value, true>, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, Value, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, Value>>>, vector<LogicalType, true>, vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, true>) + 904
15       Binder::Bind(TableFunctionRef&) + 2124
16       Binder::Bind(TableRef&) + 316
17       Binder::BindNode(SelectNode&) + 68
18       Binder::BindNode(QueryNode&) + 140
19       Binder::Bind(QueryNode&) + 48
20       Planner::CreatePlan(SQLStatement&) + 152
21       ClientContext::CreatePreparedStatementInternal(ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, optional_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, BoundParameterData, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, BoundParameterData>>>, true>) + 456
22       ClientContext::CreatePreparedStatement(ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, optional_ptr<std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, BoundParameterData, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, BoundParameterData>>>, true>, PreparedStatementMode) + 916
23       ClientContext::PendingStatementInternal(ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, PendingQueryParameters const&) + 128
24       ClientContext::PendingStatementOrPreparedStatement(ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, shared_ptr<PreparedStatementData, true>&, PendingQueryParameters const&) + 252
25       ClientContext::PendingStatementOrPreparedStatementInternal(ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, shared_ptr<PreparedStatementData, true>&, PendingQueryParameters const&) + 1476
26       ClientContext::PendingQueryInternal(ClientContextLock&, unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, PendingQueryParameters const&, bool) + 144
27       ClientContext::PendingQuery(unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, BoundParameterData, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, BoundParameterData>>>&, bool) + 288
28       ClientContext::PendingQuery(unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, bool) + 64
29       Connection::PendingQuery(unique_ptr<SQLStatement, std::__1::default_delete<SQLStatement>, true>, bool) + 64
30       duckdb_shell_sqlite3_prepare_v2 + 996
31       duckdb_shell::ShellState::ExecuteSQL(char const*, char**) + 108
32       duckdb_shell::ShellState::RunOneSqlLine(duckdb_shell::InputMode, char*) + 256
33       duckdb_shell::ShellState::ProcessInput(duckdb_shell::InputMode) + 952
34       main + 4036
35       start + 6076

This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/stable/dev/internal_errors

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions