Bug #55956 Potential bug with new --raw mode with mysqlbinlog
Submitted: 12 Aug 2010 19:10 Modified: 30 Mar 2011 7:52
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6.99 OS:Any
Assigned to: Andrei Elkin CPU Architecture:Any

[12 Aug 2010 19:10] Sveta Smirnova
Description:
There are potential bugs in mysqlbinlog.cc code:

In dump_remote_log_entries() there is the declaration of:

(line 1627) Log_event *ev;

This 'ev' is then reused later in the code, but is not always set to a proper value based on the if statements.

The problem lines of code are:

(line 1675) Rotate_log_event *rev= (Rotate_log_event *)ev;

(line 1771) Load_log_event *le= (Load_log_event*)ev;

For these 'ev' may not be properly set since it only set in certain circumstances. The first one can be easily fixed if ev is initialized to NULL or 0, whereas the second one
is more complex since it expects a real value.

Practically, this produces warnings in gcc, and also could cause a crash or problem if you are using a binary log version < 3.

How to repeat:
Use version 3.23.58, start it with --log-bin option, add some records, run 

mysqlbinlog --raw --read-from-remote-server -h127.0.0.1 -P3332 -uroot apple-bin.001, get crash because of memory corruption.
[12 Aug 2010 21:01] Mark Callaghan
gcc -Wall generates a warning for this. Hopefully, the recent changes to get rid of warnings and use -Wall will prevents future bugs like this.
[30 Mar 2011 7:52] Jon Stephens
Documented fix in the 5.6.3 changelog, as follows:

        mysqlbinlog --raw did not function correctly with binary logs
        from MySQL Server versions 5.0.3 and earlier.

Closed.