Re: [sqlite] Segfault when authorizer denies some steps of creating a WITHOUT ROWID table

2018-07-08 Thread Richard Hipp
Thanks for providing a succinct test case!  A fix is now check-in on
trunk.  https://www.sqlite.org/src/info/164b1641e346994f

Just FYI, the regression test case was added to TH3
(https://www.sqlite.org/th3.html) rather than in the main source tree
as it is much easier to incorporate there.

On 7/8/18, sql...@zzo38computer.org  wrote:
> #if 0
> gcc -s -O2 -o ./sqltest1 sqltest1.c sqlite3.o -ldl -lpthread
> exit
> #endif
>
> /*
>   Test with the command:
> ./sqltest1 2 'create table vt(a integer primary key,b,c) without rowid;'
>   It segfaults. If the first argument is 3 or 4 it also segfaults.
> */
>
> #include 
> #include 
> #include 
> #include "sqlite3.h"
>
> static int count=-1;
> static sqlite3*db;
>
> static int xAuth(void*aux,int act,const char*p3,const char*p4,const
> char*p5,const char*p6) {
>   fprintf(stderr,"%d: %d %s %s %s %s\n",count,act,p3,p4,p5,p6);
>   return count--?SQLITE_OK:SQLITE_DENY;
> }
>
> int main(int argc,char**argv) {
>   if(argc!=3) return 1;
>   if(sqlite3_open(":memory:",&db)) return 1;
>   count=strtol(argv[1],0,0);
>   sqlite3_set_authorizer(db,xAuth,0);
>   printf("%d\n",sqlite3_exec(db,argv[2],0,0,0));
>   return 0;
> }
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Segfault when authorizer denies some steps of creating a WITHOUT ROWID table

2018-07-08 Thread sqlite
#if 0
gcc -s -O2 -o ./sqltest1 sqltest1.c sqlite3.o -ldl -lpthread
exit
#endif

/*
  Test with the command:
./sqltest1 2 'create table vt(a integer primary key,b,c) without rowid;'
  It segfaults. If the first argument is 3 or 4 it also segfaults.
*/

#include 
#include 
#include 
#include "sqlite3.h"

static int count=-1;
static sqlite3*db;

static int xAuth(void*aux,int act,const char*p3,const char*p4,const 
char*p5,const char*p6) {
  fprintf(stderr,"%d: %d %s %s %s %s\n",count,act,p3,p4,p5,p6);
  return count--?SQLITE_OK:SQLITE_DENY;
}

int main(int argc,char**argv) {
  if(argc!=3) return 1;
  if(sqlite3_open(":memory:",&db)) return 1;
  count=strtol(argv[1],0,0);
  sqlite3_set_authorizer(db,xAuth,0);
  printf("%d\n",sqlite3_exec(db,argv[2],0,0,0));
  return 0;
}
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users