[Xapian-devel] "Bad serialised query" error

Olly Betts olly at survex.com
Thu Mar 29 06:10:29 BST 2007


On Thu, Mar 29, 2007 at 02:48:00PM +1000, Mark Hammond wrote:
> I've tracked it down to api/omqueryinternal.cc, in QUnserial::readquery(),
> and is the 2nd occurance of that error message in that function (ie, inside
> the "case '['" block).  It appears that the check for:
> 
> 	    if (p == end)
> 		throw Xapian::InvalidArgumentError("Bad serialised query");
> 
> works fine when a "compound" query is used, but incorrectly fails with a
> simple query that uses a single term.

That check is just wrong!  It's OK if (p == end) (but it doesn't happen
except in very particular circumstances).  We do of course need to avoid
dereferencing p in that case though.  I've checked in this fix (plus a
regression test):

http://oligarchy.co.uk/xapian/patches/xapian-query-unserialise.patch

Cheers,
    Olly



More information about the Xapian-devel mailing list