On Mar 24, 2010, at 7:11 AM, Daniel Lin wrote:

> About this bug, I found change the code to following will let it  
> workable.
> But, I require your confirm.
>
> memcpy(pKeyInfo, zP4, sizeof(*pKeyInfo));

The SQLite code is correct as written.  Your change will cause SQLite  
to malfunction.

Check-in http://www.sqlite.org/src/ci/be27897991 is an attempt to  
suppress the warning from code guard.  But as I have no way of testing  
to see if the change obtained that goal.


>
> On Wed, Mar 24, 2010 at 19:04, Daniel Lin <dlin...@gmail.com> wrote:
> Dear Dr.,
>
> I use Borland C++ Builder with code guard checking function enabled  
> mode . (on 32 bits Windows XP)
>
> I found in an amalgamation sqlite.c may cause memory overrun.
>
> SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const  
> char *zP4, int n){
> ...
>     pOp->p4.pKeyInfo = pKeyInfo;
>     if (pKeyInfo ){
>       u8 *aSortOrder;
>       memcpy(pKeyInfo, zP4, nByte);   /* this line force copy 17  
> bytes from 16 bytes structure */
>       aSortOrder = pKeyInfo->aSortOrder;
>       if( aSortOrder ){
>         pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo- 
> >aColl[nField];
>         memcpy(pKeyInfo->aSortOrder, aSortOrder, nField);
>       }
>       pOp->p4type = P4_KEYINFO;
>

D. Richard Hipp
d...@hwaci.com



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

Reply via email to