dbTalk Databases Forums  

bk commit into 4.1 tree (bar:1.2308) BUG#10714

mailing.database.mysql-internals mailing.database.mysql-internals


Discuss bk commit into 4.1 tree (bar:1.2308) BUG#10714 in the mailing.database.mysql-internals forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bar@mysql.com
 
Posts: n/a

Default bk commit into 4.1 tree (bar:1.2308) BUG#10714 - 06-02-2005 , 11:41 PM






Below is the list of changes that have just been committed into a local
4.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/in...urce-tree.html

ChangeSet
1.2308 05/06/03 09:37:53 bar (AT) mysql (DOT) com +3 -0
ctype_utf8.result, ctype_utf8.test:
adding test
field.cc:
bug#10714 Inserting double value into utf8 column crashes server:
sprintf was executed with too big length, which caused
crash on some Windows platforms.

mysql-test/r/ctype_utf8.result
1.53 05/06/03 09:36:45 bar (AT) mysql (DOT) com +3 -0
adding test

mysql-test/t/ctype_utf8.test
1.53 05/06/03 09:36:38 bar (AT) mysql (DOT) com +7 -0
adding test

sql/field.cc
1.218 05/06/03 09:35:09 bar (AT) mysql (DOT) com +8 -7
bug#10714 Inserting double value into utf8 column crashes server
sprintf was executed with too long length, which cau
crashe on Windows.

# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bar
# Host: bar.intranet.mysql.r18.ru
# Root: /usr/home/bar/mysql-4.1

--- 1.217/sql/field.cc 2005-06-02 05:23:48 +05:00
+++ 1.218/sql/field.cc 2005-06-03 09:35:09 +05:00
@@ -4981,31 +4981,32 @@
char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
uint length;
bool use_scientific_notation= TRUE;
+ uint char_length= field_length / charset()->mbmaxlen;
/*
Check fabs(nr) against longest value that can be stored in field,
which depends on whether the value is < 1 or not, and negative or not
*/
double anr= fabs(nr);
int neg= (nr < 0.0) ? 1 : 0;
- if (field_length > 4 && field_length < 32 &&
- (anr < 1.0 ? anr > 1/(log_10[max(0,field_length-neg-2)]) /* -2 for "0." */
- : anr < log_10[field_length-neg]-1))
+ if (char_length > 4 && char_length < 32 &&
+ (anr < 1.0 ? anr > 1/(log_10[max(0,char_length-neg-2)]) /* -2 for "0." */
+ : anr < log_10[char_length-neg]-1))
use_scientific_notation= FALSE;

length= (uint) my_sprintf(buff, (buff, "%-.*g",
(use_scientific_notation ?
- max(0, (int)field_length-neg-5) :
- field_length),
+ max(0, (int)char_length-neg-5) :
+ char_length),
nr));
/*
+1 below is because "precision" in %g above means the
max. number of significant digits, not the output width.
Thus the width can be larger than number of significant digits by 1
(for decimal point)
- the test for field_length < 5 is for extreme cases,
+ the test for char_length < 5 is for extreme cases,
like inserting 500.0 in char(1)
*/
- DBUG_ASSERT(field_length < 5 || length <= field_length+1);
+ DBUG_ASSERT(char_length < 5 || length <= char_length+1);
return store((const char *) buff, length, charset());
}


--- 1.52/mysql-test/r/ctype_utf8.result 2005-05-09 20:54:58 +05:00
+++ 1.53/mysql-test/r/ctype_utf8.result 2005-06-03 09:36:45 +05:00
@@ -888,3 +888,6 @@
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string')
string
+create table t1 (a varchar(255)) default character set utf8;
+insert into t1 values (1.0);
+drop table t1;

--- 1.52/mysql-test/t/ctype_utf8.test 2005-05-09 20:54:58 +05:00
+++ 1.53/mysql-test/t/ctype_utf8.test 2005-06-03 09:36:38 +05:00
@@ -724,3 +724,10 @@
drop table t1;
select repeat(_utf8'+',3) as h union select NULL;
select ifnull(NULL, _utf8'string');
+
+#
+# Bug#10714: Inserting double value into utf8 column crashes server
+#
+create table t1 (a varchar(255)) default character set utf8;
+insert into t1 values (1.0);
+drop table t1;

--
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe: http://lists.mysql.com/internals?uns...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.