Use-After-Free in SQLite Aggregate Arguments in Heap-Allocated Argument Array
Published: August 11, 2026
SECURITY IDENTIFIERS
- GHSA: GHSA-mwm8-39rw-8826
- Vendor Advisory: https://github.com/sparklemotion/sqlite3-ruby/security/advisories/GHSA-mwm8-39rw-8826
GEM
UNAFFECTED VERSIONS
< 1.4.0
PATCHED VERSIONS
>= 2.9.6
DESCRIPTION
Summary
Using Database#create_aggregate, #create_aggregate_handler, or Database#define_aggregator to define an aggregate function that takes two or more arguments, and then evaluating it over TEXT or BLOB column values, can free the Ruby objects holding those arguments while a later argument is still being converted, during ordinary garbage collection. The aggregate's step method then receives an incorrect object, or the process crashes with a segmentation fault.
Credits
Reported by Jeremy Daer (@jeremy).
