fts5ubsan.test 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # 2022 August 9
  2. #
  3. # The author disclaims copyright to this source code. In place of
  4. # a legal notice, here is a blessing:
  5. #
  6. # May you do good and not evil.
  7. # May you find forgiveness for yourself and forgive others.
  8. # May you share freely, never taking more than you give.
  9. #
  10. #***********************************************************************
  11. #
  12. # This test is focused on edge cases that cause ubsan errors.
  13. #
  14. source [file join [file dirname [info script]] fts5_common.tcl]
  15. set testprefix fts5ubsan
  16. # If SQLITE_ENABLE_FTS5 is not defined, omit this file.
  17. ifcapable !fts5 {
  18. finish_test
  19. return
  20. }
  21. do_execsql_test 1.0 {
  22. CREATE VIRTUAL TABLE x1 USING fts5(x);
  23. }
  24. set BIG 9000000000000000000
  25. set SMALL -9000000000000000000
  26. do_execsql_test 1.1 {
  27. BEGIN;
  28. INSERT INTO x1 (rowid, x) VALUES($BIG, 'aaa aba acc');
  29. INSERT INTO x1 (rowid, x) VALUES($SMALL, 'aaa abc acb');
  30. COMMIT;
  31. }
  32. do_execsql_test 1.2 {
  33. SELECT rowid, x FROM x1('ab*');
  34. } [list $SMALL {aaa abc acb} $BIG {aaa aba acc}]
  35. do_execsql_test 1.3 {
  36. SELECT rowid, x FROM x1('ac*');
  37. } [list $SMALL {aaa abc acb} $BIG {aaa aba acc}]
  38. reset_db
  39. do_execsql_test 2.0 {
  40. CREATE VIRTUAL TABLE x1 USING fts5(x);
  41. }
  42. do_execsql_test 2.1 {
  43. INSERT INTO x1 (rowid, x) VALUES($BIG, 'aaa aba acc');
  44. INSERT INTO x1 (rowid, x) VALUES($SMALL, 'aaa abc acb');
  45. }
  46. do_execsql_test 2.2 {
  47. INSERT INTO x1 (x1) VALUES('optimize');
  48. }
  49. finish_test