jakethaw / pivot_vtab

SQLite3 pivot virtual table
MIT License
29 stars 1 forks source link

Segmentation fault on pivot_vtab refering to non-existent table #1

Closed saaj closed 3 years ago

saaj commented 3 years ago

Steps to reproduce

$ docker run --rm -it -w /tmp/build ubuntu:focal
# apt update
# apt install -y --no-install-recommends \
  sqlite3 libsqlite3-dev gcc wget ca-certificates
# wget https://github.com/jakethaw/pivot_vtab/raw/6186c43/pivot_vtab.c
# gcc -g -O3 -fPIC -shared pivot_vtab.c -o pivot_vtab.so
# sqlite3
sqlite> .load ./pivot_vtab
sqlite> CREATE VIRTUAL TABLE temp.pivot USING pivot_vtab(
   ...>   (SELECT y FROM point GROUP BY y),
   ...>   (SELECT x, x FROM point GROUP BY x),   
   ...>   (SELECT z FROM point WHERE y = ?1 AND x = ?2)
   ...> );
Segmentation fault (core dumped)

Expected behaviour

Error message printed

Actual behaviour

sqlite3 processes crashes with a segfault.