Crash using query logging and use <dbname> statement

Bug #421345 reported by fmpwizard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
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

Revision history for this message
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)
Revision history for this message
Monty Taylor (mordred) wrote : Re: [Bug 421345] Re: Crash using query logging and use <dbname> statement

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.

Revision history for this message
Jay Pipes (jaypipes) wrote : Re: [Bug 421345] Re: Crash using query logging and use <dbname> statement

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
Changed in drizzle:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.