Crash using query logging and use <dbname> statement

Bug #421345 reported by fmpwizard on 2009-08-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
High
fmpwizard

Bug Description

Having the query logging plugin enabled, if you send a "USE information_schema" query, drizzle will crash.

I believe this is because when you execute the USE <dbname> statement, you end up with two queries, one is a SELECT DATABASE() and then a INIT_DB, the second one does not have a value for session->query, and this causes a crash on session->getQueryLength()

This bug most likely also affects the gearman and syslog logging plugins.

This is using drizzle rev 1126. on mac os 10.5
================
Would you agree that a fix for this bug is to simple add entries to the log if session->query (the query text) has a value?

Related branches

fmpwizard (diego-fmpwizard) wrote :

I thought a little more about it, and a better fix could be to modify getQueryLength() to check is query != NULL, and then decide to return strlen or 0.

I like this solution better because it allows anyone to call getQueryLength() without having to worry about query being NULL. (And it works :) )

Changed in drizzle:
assignee: nobody → fmpwizard (diego-fmpwizard)

fmpwizard wrote:
> I thought a little more about it, and a better fix could be to modify
> getQueryLength() to check is query != NULL, and then decide to return
> strlen or 0.
>
> I like this solution better because it allows anyone to call
> getQueryLength() without having to worry about query being NULL. (And it
> works :) )

I think this is the right thing.

Monty Taylor wrote:
> fmpwizard wrote:
>> I thought a little more about it, and a better fix could be to modify
>> getQueryLength() to check is query != NULL, and then decide to return
>> strlen or 0.
>>
>> I like this solution better because it allows anyone to call
>> getQueryLength() without having to worry about query being NULL. (And it
>> works :) )
>
> I think this is the right thing.

Yeah, for now. The *right* thing is replacing char *query with
std::string &query...

-jay

Changed in drizzle:
status: New → Fix Committed
Lee Bieber (kalebral) on 2009-09-27
Changed in drizzle:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers