Bug#12547: Inserting long string into varchar causes table crash in cp932

ctype-cp932.c:
  Decrement for "pos" variable disappered somehow.
  Restoring it back.
ctype_cp932.test: ctype_cp932.result:
  Adding test case.
This commit is contained in:
bar@mysql.com 2005-10-11 12:09:38 +05:00
parent bef189cc4e
commit 735f424b5c
3 changed files with 28 additions and 1 deletions

View file

@ -11349,3 +11349,20 @@ cp932_bin 6109
cp932_bin 61
cp932_bin 6120
drop table t1;
create table t1 (col1 varchar(1)) character set cp932;
insert into t1 values ('a');
insert into t1 values ('ab');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
select * from t1;
col1
a
a
insert into t1 values ('abc');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
select * from t1;
col1
a
a
a

View file

@ -424,3 +424,13 @@ SET collation_connection='cp932_japanese_ci';
-- source include/ctype_filesort.inc
SET collation_connection='cp932_bin';
-- source include/ctype_filesort.inc
#
# Bug#12547: Inserting long string into varchar causes table crash in cp932
#
create table t1 (col1 varchar(1)) character set cp932;
insert into t1 values ('a');
insert into t1 values ('ab');
select * from t1;
insert into t1 values ('abc');
select * from t1;

View file

@ -5417,7 +5417,7 @@ uint my_well_formed_len_cp932(CHARSET_INFO *cs __attribute__((unused)),
{
const char *b0= b;
*error= 0;
while (pos && b < e)
while (pos-- && b < e)
{
/*
Cast to int8 for extra safety.