Re: [sqlite] strange UB detected

2011-03-13 Thread Jay A. Kreibich
On Sun, Mar 13, 2011 at 06:14:49PM +0200, Eugene N scratched on the wall: > uchar* pblah[1]; > pblah[0] = (uchar*)malloc(10); > pblah[1] = (uchar*)malloc(10); // notice the order > Any ideas why? Because pblah is a *one*-element array. -j -- Jay A. Kreibich < J A Y @ K R E I B I.C

Re: [sqlite] strange UB detected

2011-03-13 Thread Eugene N
Thanks! I forgot about C array numeration... Sorry for being an arse. Eugene 2011/3/13 Drake Wilson > Quoth Eugene N , on 2011-03-13 18:14:49 > +0200: > > uchar* pblah[1]; > > > > pblah[0] = (uchar*)malloc(10); > > > > pblah[1] =

Re: [sqlite] strange UB detected

2011-03-13 Thread Drake Wilson
Quoth Eugene N , on 2011-03-13 18:14:49 +0200: > uchar* pblah[1]; > > pblah[0] = (uchar*)malloc(10); > > pblah[1] = (uchar*)malloc(10); // notice the order > > sqlite3* db; Your C code is broken. pblah is an array of 1 element, which is accessible (among other

[sqlite] strange UB detected

2011-03-13 Thread Eugene N
Hi I detected a strange "feature" of sqlite3. Somebody called it Pointer Liberation army strike. uchar* pblah[1]; pblah[0] = (uchar*)malloc(10); pblah[1] = (uchar*)malloc(10); // notice the order sqlite3* db; // this call magically kills pblah[1] by making it 0x0 int ret =