SQLite

Check-in [1aaa06e37f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add extra tests to check the result of including a %00 escape in a URI when ENABLE_URI_00_ERROR is defined.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | uri-00-error
Files: files | file ages | folders
SHA1: 1aaa06e37f44309c62335d8eda59ca6890d4be9d
User & Date: dan 2016-10-26 13:44:07.443
Context
2016-10-26
13:58
Merge the SQLITE_ENABLE_URI_00_ERROR compile-time option. (check-in: 86675ae0ab user: drh tags: trunk)
13:44
Add extra tests to check the result of including a %00 escape in a URI when ENABLE_URI_00_ERROR is defined. (Closed-Leaf check-in: 1aaa06e37f user: dan tags: uri-00-error)
12:15
Add compile time option SQLITE_ENABLE_URI_00_ERROR. If defined, any "%00" escape found in a URI is treated as an error. (check-in: e8a9bfece2 user: dan tags: uri-00-error)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/uri2.test.
32
33
34
35
36
37
38







39
40
41
42




43
44
45
46
47
48
49
  5 file:test.db?trailing=1&abc%00def
} {
  do_test 1.$tn.1 {
    set rc [catch { sqlite3 db $uri } msg]
    list $rc $msg
  } {1 {unexpected %00 in uri}}








  do_test 1.$tn.2 {
    sqlite3 db ""
    catchsql { ATTACH $uri AS aux }
  } {1 {unexpected %00 in uri}}





  catch { db close }
}

reset_db
do_test 2.0 {
  expr {[lsearch [execsql {PRAGMA compile_options}] ENABLE_URI_00_ERROR] >= 0}







>
>
>
>
>
>
>




>
>
>
>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  5 file:test.db?trailing=1&abc%00def
} {
  do_test 1.$tn.1 {
    set rc [catch { sqlite3 db $uri } msg]
    list $rc $msg
  } {1 {unexpected %00 in uri}}

  do_test 1.$tn.2 {
    set DB2 [sqlite3_open $uri]
    sqlite3_errcode $DB2
  } {SQLITE_ERROR}

  catch { sqlite3_close $DB2 }

  do_test 1.$tn.2 {
    sqlite3 db ""
    catchsql { ATTACH $uri AS aux }
  } {1 {unexpected %00 in uri}}

  do_test 1.$tn.3 {
    sqlite3_errcode db
  } {SQLITE_ERROR}

  catch { db close }
}

reset_db
do_test 2.0 {
  expr {[lsearch [execsql {PRAGMA compile_options}] ENABLE_URI_00_ERROR] >= 0}