Bug #9358 mysqldump crashes if tablename starts with \
Submitted: 23 Mar 2005 13:36 Modified: 14 Jul 2005 18:20
Reporter: Jan Kneschke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S3 (Non-critical)
Version:4.1.10a OS:Windows (WindowsXP SP2/Linux)
Assigned to: Magnus Blåudd CPU Architecture:Any

[23 Mar 2005 13:36] Jan Kneschke
Description:
mysqldump is crashing if the tablename contains a \ at start and --master-data is specified.

How to repeat:
$ mysqldump --master-data world  \dump-20050323-1429.sql
-- MySQL dump 10.9
--
-- Host: localhost    Database: world
-- ------------------------------------------------------
-- Server version       4.1.10a-nt-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0
*/;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

--
-- Position to start replication or point-in-time recovery from
--

CHANGE MASTER TO MASTER_LOG_FILE='D2XNG01J-bin.000001', MASTER_LOG_POS=1403;

(crash)

Suggested fix:
complain about not existing table
[23 Mar 2005 14:02] MySQL Verification Team
Thank you for the bug report.

mysqldump.c
--2115--

    safe_exit(EX_MYSQLERR);
  }

  tableRes= mysql_store_result( sock );
  row= mysql_fetch_row( tableRes );
  strmake(new_table_name, row[0], buf_size-1);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CRASH HERE
  mysql_free_result(tableRes);
}

>	mysqldump.exe!get_actual_table_name(const char * old_table_name=0x00362d12, char * new_table_name=0x0012fe4c, int buf_size=64)  Line 2120 + 0xa	C
 	mysqldump.exe!dump_selected_tables(char * db=0x00362d0c, char * * table_names=0x003656c0, int tables=1)  Line 2161 + 0x14	C
 	mysqldump.exe!main(int argc=2, char * * argv=0x003656bc)  Line 2499 + 0x19	C
 	mysqldump.exe!mainCRTStartup()  Line 206 + 0x19	C
 	kernel32.dll!7c816d4f() 	
 	kernel32.dll!7c8399f3()
[23 Mar 2005 14:31] MySQL Verification Team
Also affected Unix version:

-- Position to start replication or point-in-time recovery from
--

CHANGE MASTER TO MASTER_LOG_FILE='hegel-bin.000024', MASTER_LOG_POS=564497;
Segmentation fault
miguel@hegel:~/dbs/4.1$
[13 Jun 2005 19:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25948
[17 Jun 2005 18:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26132
[20 Jun 2005 13:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/26196
[27 Jun 2005 10:55] Magnus Blåudd
Pushed to 4.1.13 and 5.0.9
[14 Jul 2005 18:20] Paul DuBois
Noted in 4.1.13, 5.0.9 changelogs.