Skip to content

[BUG] SIGSEGV endpoints with data:// location for some table functions #43

@VGSML

Description

@VGSML

The problem:

When a Flight server returns endpoints with data:// URIs containing encoded DuckDB table function calls (media type application/x-msgpack-duckdb-function-call;base64), the extension creates an AirportLocalScanData to execute the function locally. However, AirportLocalScanData (in src/airport_flight_stream.cpp) assumes the table function follows the standard function pattern - it requires init_global and calls table_function.function() to produce output.

Functions like generate_series and range use the in_out_function pattern instead:

  • init_global = nullptr (no global state)
  • function = nullptr (the main scan callback)
  • in_out_function is set (the actual execution path)

This causes a SIGSEGV at src/airport_flight_stream.cpp:309 when func.init_global(context, input) is called on a null function pointer.

Even if init_global were guarded, AirportDataFromLocalScanFunction at src/airport_take_flight.cpp:371 would also crash calling scan_data->table_function.function(context, function_input, output) on a null pointer.

Temporary fix: throw NotImplementedException when func.init_global is null (airport_flight_stream.cpp:306-307).

Permanent fix: Extend AirportLocalScanData and AirportDataFromLocalScanFunction to support the in_out_function execution pattern - handle null init_global/init_local, and call in_out_function/in_out_function_final instead of function when appropriate.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions