Commented out that 1 line from the amalgamation and can confirm that I'm no 
longer crashing on those queries.


-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Richard Hipp
Sent: Friday, November 09, 2018 9:26 AM
To: SQLite mailing list
Cc: c...@jeremyevans.net
Subject: Re: [sqlite] Segmentation Fault When Using Window Function

On 11/7/18, Jeremy Evans <c...@jeremyevans.net> wrote:
> The following SQL causes a segmentation fault on:

Thank you for the bug report and reproducible test case.

The problem actually had nothing to do with window functions.  The use
of window functions merely made the bug easier to hit.  The bug has
gone undetected in the code for over three years.  It is now fixed on
trunk.  If you can, please download and compile the latest trunk
version and let us know whether or not it is working better for you.

If you do not want to download and compile from canonical sources, you can patch
your "sqlite3.c" source file by removing a single line of code:

--- sqlite3.c-baseline
+++ sqlite3.c
@@ -139937,21 +139937,20 @@
   );
   sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
   sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
   if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
   if( pTabItem->fg.viaCoroutine ){
     sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
     testcase( pParse->db->mallocFailed );
     translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
                           pTabItem->regResult, 1);
     sqlite3VdbeGoto(v, addrTop);
-    pTabItem->fg.viaCoroutine = 0;  /* REMOVE THIS LINE OF CODE */
   }else{
     sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
   }
   sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
   sqlite3VdbeJumpHere(v, addrTop);
   sqlite3ReleaseTempReg(pParse, regRecord);

   /* Jump here when skipping the initialization */
   sqlite3VdbeJumpHere(v, addrInit);
-- 
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-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to