Re: [sqlite] Crash (c0000005 - Access Violation) in sqlite3.exe

2012-03-31 Thread Yuriy Kaminskiy
Yuriy Kaminskiy wrote:
> Richard Hipp wrote:
>> On Thu, Feb 23, 2012 at 12:29 PM, Petite Abeille
>> wrote:
>>
>>> On Feb 23, 2012, at 6:21 PM, Levi Haskell wrote:
>>>
 sqlite> select 1 from (select *);
>>> Wow, wicked :)
>>>
>>> Confirmed on sqlite3 -version
>>> 3.7.10 2012-01-16 13:28:40 ebd01a8deffb5024a5d7494eef800d2366d97204
>>>
>>
>> Fixed here:  http://www.sqlite.org/src/info/c8c7846fb9
> 
> This fix triggers SQLITE_NOMEM and test/select1.test select1-16.1 failure when
> lookaside allocation failed (or sqlite compiled with SQLITE_OMIT_LOOKASIDE):
>> select1-16.1...
>> Expected: [1 {no tables specified}]
>>  Got: [1 {out of memory}]
> Maybe sqlite3Malloc() should be changed to NOT return NULL when called with 
> n==0.
Conservative fix:

Index: sqlite3-3.7.11/src/select.c
===
--- sqlite3-3.7.11.orig/src/select.c2012-03-31 12:32:12.0 +0400
+++ sqlite3-3.7.11/src/select.c 2012-03-31 12:34:42.0 +0400
@@ -1258,7 +1258,11 @@ static int selectColumnsFromExprList(
   char *zName;/* Column name */
   int nName;  /* Size of name in zName[] */

-  *pnCol = nCol = pEList ? pEList->nExpr : 0;
+  if( !pEList ){
+*pnCol = 0; *paCol = NULL;
+return SQLITE_OK;
+  }
+  *pnCol = nCol = pEList->nExpr;
   aCol = *paCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol);
   if( aCol==0 ) return SQLITE_NOMEM;
   for(i=0, pCol=aCol; ihttp://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Crash (c0000005 - Access Violation) in sqlite3.exe

2012-03-31 Thread Yuriy Kaminskiy
Richard Hipp wrote:
> On Thu, Feb 23, 2012 at 12:29 PM, Petite Abeille
> wrote:
> 
>> On Feb 23, 2012, at 6:21 PM, Levi Haskell wrote:
>>
>>> sqlite> select 1 from (select *);
>> Wow, wicked :)
>>
>> Confirmed on sqlite3 -version
>> 3.7.10 2012-01-16 13:28:40 ebd01a8deffb5024a5d7494eef800d2366d97204
>>
> 
> 
> Fixed here:  http://www.sqlite.org/src/info/c8c7846fb9

This fix triggers SQLITE_NOMEM and test/select1.test select1-16.1 failure when
lookaside allocation failed (or sqlite compiled with SQLITE_OMIT_LOOKASIDE):
> select1-16.1...
> Expected: [1 {no tables specified}]
>  Got: [1 {out of memory}]
Maybe sqlite3Malloc() should be changed to NOT return NULL when called with 
n==0.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Crash (c0000005 - Access Violation) in sqlite3.exe

2012-02-23 Thread Richard Hipp
On Thu, Feb 23, 2012 at 12:29 PM, Petite Abeille
wrote:

>
> On Feb 23, 2012, at 6:21 PM, Levi Haskell wrote:
>
> > sqlite> select 1 from (select *);
>
> Wow, wicked :)
>
> Confirmed on sqlite3 -version
> 3.7.10 2012-01-16 13:28:40 ebd01a8deffb5024a5d7494eef800d2366d97204
>


Fixed here:  http://www.sqlite.org/src/info/c8c7846fb9



>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] Crash (c0000005 - Access Violation) in sqlite3.exe

2012-02-23 Thread Petite Abeille

On Feb 23, 2012, at 6:21 PM, Levi Haskell wrote:

> sqlite> select 1 from (select *);

Wow, wicked :) 

Confirmed on sqlite3 -version
3.7.10 2012-01-16 13:28:40 ebd01a8deffb5024a5d7494eef800d2366d97204


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users