SQLite

Check-in [eed1e03072]
Login

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

Overview
Comment:A call to sqlite3_declare_vtab() should not cause DML/DDL authorization failures.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: eed1e030722deb24674e7c2d165a2a359576c6bb5769d3bdd5fa645bc0f2ecc7
User & Date: drh 2022-12-29 18:54:15.153
Context
2022-12-31
05:19
Avoid an infinite loop when an unexpected character is being decoded by kvvfs (check-in: 6909195f77 user: peter.d.reid tags: trunk)
2022-12-29
18:54
A call to sqlite3_declare_vtab() should not cause DML/DDL authorization failures. (check-in: eed1e03072 user: drh tags: trunk)
2022-12-27
22:46
Add sqlite3changeset_new/old_js(), which work like sqlite3_preupdate_new/old_js() but on changesets. (check-in: e8afad630b user: stephan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/build.c.
303
304
305
306
307
308
309

310
311
312
313
314
315
316
  va_list ap;
  char *zSql;
  sqlite3 *db = pParse->db;
  u32 savedDbFlags = db->mDbFlags;
  char saveBuf[PARSE_TAIL_SZ];

  if( pParse->nErr ) return;

  assert( pParse->nested<10 );  /* Nesting should only be of limited depth */
  va_start(ap, zFormat);
  zSql = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  if( zSql==0 ){
    /* This can result either from an OOM or because the formatted string
    ** exceeds SQLITE_LIMIT_LENGTH.  In the latter case, we need to set







>







303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
  va_list ap;
  char *zSql;
  sqlite3 *db = pParse->db;
  u32 savedDbFlags = db->mDbFlags;
  char saveBuf[PARSE_TAIL_SZ];

  if( pParse->nErr ) return;
  if( pParse->eParseMode ) return;
  assert( pParse->nested<10 );  /* Nesting should only be of limited depth */
  va_start(ap, zFormat);
  zSql = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  if( zSql==0 ){
    /* This can result either from an OOM or because the formatted string
    ** exceeds SQLITE_LIMIT_LENGTH.  In the latter case, we need to set
Changes to test/auth.test.
2242
2243
2244
2245
2246
2247
2248













2249
2250
2251
2252
2253
2254
2255
    SELECT name FROM pragma_table_info('t1') ORDER BY cid;
  } {a bcdefg}
  do_test auth-1.358 {
    set authargs
  } {main t1 {} {}}
}















do_test auth-2.1 {
  proc auth {code arg1 arg2 arg3 arg4 args} {
    if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} {
      return SQLITE_DENY
    }
    return SQLITE_OK







>
>
>
>
>
>
>
>
>
>
>
>
>







2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
    SELECT name FROM pragma_table_info('t1') ORDER BY cid;
  } {a bcdefg}
  do_test auth-1.358 {
    set authargs
  } {main t1 {} {}}
}

# 2022-12-28
# The sqlite3_declare_vtab() call that occurs during pragma_table_list
# should not cause an authentication failure.
#
do_test auth-1.359 {
  proc auth {code arg1 arg2 arg3 arg4 args} {
    if {$code=="SQLITE_UPDATE"} {
      return SQLITE_DENY
    }
    return SQLITE_OK
  }
  catchsql {SELECT * FROM pragma_table_list WHERE name='xyzzy';}
} {0 {}}

do_test auth-2.1 {
  proc auth {code arg1 arg2 arg3 arg4 args} {
    if {$code=="SQLITE_READ" && $arg1=="t3" && $arg2=="x"} {
      return SQLITE_DENY
    }
    return SQLITE_OK