Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40759

`mariadb-binlog --force-read --start-position` crashes on Unknown event

    XMLWordPrintable

Details

    • Can result in hang or crash

    Description

      --source include/have_debug.inc
      --source include/have_binlog_format_mixed.inc # format-agnostic
       
      --let $MYSQL_DATADIR= `SELECT @@datadir`
      --let $binlog_file=  query_get_value(SHOW BINLOG STATUS, File,     1)
      --let $binlog_start= query_get_value(SHOW BINLOG STATUS, Position, 1)
       
      --exec $MYSQL_BINLOG --verify-binlog-checksum --force-read --debug=d,simulate_checksum_test_failure --start-position=$binlog_start $MYSQL_DATADIR/$binlog_file
      

      /path/to/src/client/mysqlbinlog.cc: runtime error: downcast of address which does not point to an object of type 'Format_description_log_event'
      note: object is of type 'Unknown_log_event'
      

      Code Analysis

      In static check_header(), --start-position's prelude code that finds the Format Description uses C-cast (roughly equivalent to C++ reinterpret_cast()), which expects the event to be either a Format Description or nullptr.
      But --force-read generates an Unknown event instead of a nullptr.

      Fix Suggestions

      • Use C++ dynamic_cast()
      • Get rid of the entire check_header() prelude during MDEV-40760

      Attachments

        Issue Links

          Activity

            People

              ParadoxV5 Jimmy Hú
              ParadoxV5 Jimmy Hú
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 2.5h Remaining Estimate - 1d 6.25h
                  1d 6.25h
                  Logged:
                  Time Spent - 2.5h Remaining Estimate - 1d 6.25h
                  2.5h

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.