Bug #5126 Mediumint and PS problem

Submitted: 20 Aug 2004 13:45 Modified: 27 Aug 2004 8:25
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1, 5.0.2 OS:Linux (Linux/Windows)
Assigned to: Konstantin Osipov CPU Architecture:Any

[20 Aug 2004 13:45] Georg Richter
Description:
Fetching mediumints cause some strange problems. 
 
I added 2 testcases, one fetching to long, the other fetching to string. 
When replacing INSERT INTO t1 VALUES (8386608,1) with 
 
A very strange behaviour: When changing  the values in INSERT to  
 
INSERT INTO t1 VALUES (999999999999999999999,1) 
 
both tests segfaults. (Thx to Hakan which detected the segfault). 

How to repeat:
static void test_mediumint2long() 
{ 
  MYSQL_STMT *stmt; 
  MYSQL_BIND bind[2]; 
  long c1, c2; 
  const char *stmt_text; 
  int rc; 
 
  myheader("fetch_mediumint2long"); 
 
  stmt_text= "DROP TABLE IF EXISTS t1"; 
  rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); 
  myquery(rc); 
 
  stmt_text= "CREATE TABLE t1 (a mediumint, b int)"; 
  rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); 
  myquery(rc); 
 
  stmt_text= "INSERT INTO t1 VALUES (8386608, 1)"; 
//  stmt_text= "INSERT INTO t1 VALUES (99999999999999999999999999, 1)"; 
  rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); 
  myquery(rc); 
 
  stmt= mysql_stmt_init(mysql); 
  stmt_text= "SELECT a, b FROM t1"; 
  rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); 
  check_execute(stmt, rc); 
  rc= mysql_stmt_execute(stmt); 
  check_execute(stmt, rc); 
 
  /* Bind output buffers */ 
  bzero(bind, sizeof(bind)); 
 
  bind[0].buffer_type= MYSQL_TYPE_LONG; 
  bind[0].buffer= &c1; 
  bind[1].buffer_type= MYSQL_TYPE_LONG; 
  bind[1].buffer= &c2; 
 
  mysql_stmt_bind_result(stmt, bind); 
 
  rc= mysql_stmt_fetch(stmt); 
  assert(rc == 0); 
  printf("%ld, %ld\n", c1, c2); 
  mysql_stmt_close(stmt); 
}
[20 Aug 2004 13:47] Georg Richter
Correction: Only 1 test :), but it happens also when fetching to a string
[21 Aug 2004 4:27] MySQL Verification Team
Tested against latest 4.1.4 source tree on Windows.

call stack:

>	libmysql.dll!fetch_result_int32(st_mysql_bind * param=0x00915220, unsigned char * * row=0x0012fe84)  Line 3717 + 0x5	C
 	libmysql.dll!stmt_fetch_row(st_mysql_stmt * stmt=0x0036dc68, unsigned char * row=0x0136c962)  Line 4037 + 0xe	C
 	libmysql.dll!mysql_stmt_fetch(st_mysql_stmt * stmt=0x0036dc68)  Line 4073 + 0x2a	C
 	bug5126.exe!main()  Line 150 + 0x9	C++
 	bug5126.exe!mainCRTStartup()  Line 206 + 0x19	C
 	kernel32.dll!77e714c7() 	
 	ntdll.dll!77f944a8()
[26 Aug 2004 10:48] Konstantin Osipov
bk commit into 4.1 tree (konstantin:1.2000)
[27 Aug 2004 8:25] Konstantin Osipov
Fixed in 4.1.4 , bk commit - 4.1 tree (konstantin:1.2011) BUG#5126

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.