On 03/31/2012 04:04 PM, Yuriy Kaminskiy wrote:
valgrind ./testfixture test/trigger7.test

Note: line numbers below are off-by-2.

trigger7-2.1... Ok
trigger7-2.2...==11533== Invalid read of size 1

Seems always reproducible.

Thanks for reporting this.

These tests are run with valgrind as part of the release process.
But this error only shows up when you build with SQLITE_OMIT_LOOKASIDE
(or disable the lookaside allocator some other way). I think this is
probably better - perhaps we should disable lookaside when running
valgrind tests during release testing too.

It seems patch below fixes it (but I'm not sure if it is correct/sufficient;
codepath seems common, why it is only triggered by this test is not clear).

The patch looks correct and safe to me. The only possible problem
is that the modification adds (a tiny amount of) code to one of
the most performance sensitive functions in the library.

I think the reason this hasn't shown up before is that Mem.z is
not valid unless either the MEM_Str or MEM_Blob flag is set on
the memory cell. So accessing it when these flags are both clear
is a bug in sqlite3VdbeMemGrow(). The bug is only triggered when
the 'preserve' argument to sqlite3VdbeMemGrow() is true.

And the only place where sqlite3VdbeMemGrow() is called with
the preserve flag set to true and a memory cell that does not
have either the MEM_Str or MEM_Blob is from the code to do
EXPLAIN listing of trigger programs.

This fix changes the EXPLAIN listing code so that it doesn't do
that:

    http://www.sqlite.org/src/info/c9342ca581?sbs=0

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

Reply via email to