SQLite Forum

Segmentation fault in function isLikeOrGlob()
Login
Hello developers,

We found a testcase causing a SQLite crash exception:

```
CREATE TABLE t0(a PRIMARY KEY,b CHAR(30) AS(1) UNIQUE) WITHOUT ROWID;
SELECT * FROM t0 JOIN t0 AS ra0 ON unlikely(ra0.a=t0.a) AND t0.b='iii' WHERE ra0.a=false OR t0.b LIKE '.' AND t0.a=ra0.b;
```

We simply analyzed the cause of the crash, locating it in the function isLikeOrGlob().

In this line:

`|| IsVirtual(pLeft->y.pTab)  /* Value might be numeric */`

`pLeft->y.pTab` is a NULL pointer, and the use of macro:

 `#  define IsVirtual(X)      ((X)->eTabType==TABTYP_VTAB)`

triggers the segmentation fault.

Bisecting shows the problem may be related to [check-in b99d570131](https://sqlite.org/src/info/b99d570131).