Skip to content

Commit d733b63

Browse files
author
Guilhem Bichot
committed
merge with trunk
2 parents 5a02206 + d41c02b commit d733b63

12 files changed

Lines changed: 26 additions & 19 deletions

File tree

mysql-test/r/sp-bugs.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,12 @@ DROP TABLE db1.t1;
110110
DROP DATABASE db1;
111111
DROP DATABASE db2;
112112
End of 5.1 tests
113+
#
114+
# BUG#13489996 valgrind:conditional jump or move depends on
115+
# uninitialised values-field_blob
116+
#
117+
CREATE FUNCTION sf() RETURNS BLOB RETURN "";
118+
SELECT sf();
119+
sf()
120+
121+
DROP FUNCTION sf;

mysql-test/t/sp-bugs.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,12 @@ DROP TABLE db1.t1;
139139
DROP DATABASE db1;
140140
DROP DATABASE db2;
141141
--echo End of 5.1 tests
142+
143+
--echo #
144+
--echo # BUG#13489996 valgrind:conditional jump or move depends on
145+
--echo # uninitialised values-field_blob
146+
--echo #
147+
148+
CREATE FUNCTION sf() RETURNS BLOB RETURN "";
149+
SELECT sf();
150+
DROP FUNCTION sf;

sql/field.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ uint Field::fill_cache_field(CACHE_FIELD *copy)
17531753
if (flags & BLOB_FLAG)
17541754
{
17551755
copy->type= CACHE_BLOB;
1756-
copy->length-= table->s->blob_ptr_size;
1756+
copy->length-= portable_sizeof_char_ptr;
17571757
return copy->length;
17581758
}
17591759
else if (!zero_pack() &&
@@ -10161,10 +10161,6 @@ Create_field::Create_field(Field *old_field,Field *orig_field) :
1016110161
charset(old_field->charset()), // May be NULL ptr
1016210162
field(old_field)
1016310163
{
10164-
/* Fix if the original table had 4 byte pointer blobs */
10165-
if (flags & BLOB_FLAG)
10166-
pack_length= (pack_length- old_field->table->s->blob_ptr_size +
10167-
portable_sizeof_char_ptr);
1016810164

1016910165
switch (sql_type) {
1017010166
case MYSQL_TYPE_BLOB:

sql/field.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2991,6 +2991,7 @@ class Field_blob :public Field_longstr {
29912991
Field_blob(uint32 packlength_arg)
29922992
:Field_longstr((uchar*) 0, 0, (uchar*) "", 0, NONE, "temp", system_charset_info),
29932993
packlength(packlength_arg) {}
2994+
/* Note that the default copy constructor is used, in clone() */
29942995
enum_field_types type() const { return MYSQL_TYPE_BLOB;}
29952996
bool match_collation_to_optimize_range() const { return true; }
29962997
enum ha_base_keytype key_type() const
@@ -3012,7 +3013,7 @@ class Field_blob :public Field_longstr {
30123013
uint32 key_length() const { return 0; }
30133014
void sort_string(uchar *buff,uint length);
30143015
uint32 pack_length() const
3015-
{ return (uint32) (packlength+table->s->blob_ptr_size); }
3016+
{ return (uint32) (packlength + portable_sizeof_char_ptr); }
30163017

30173018
/**
30183019
Return the packed length without the pointer size added.

sql/field_conv.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,8 +649,8 @@ Copy_field::get_copy_func(Field *to,Field *from)
649649
if (from_length != to_length || !compatible_db_low_byte_first)
650650
{
651651
// Correct pointer to point at char pointer
652-
to_ptr+= to_length - to->table->s->blob_ptr_size;
653-
from_ptr+= from_length- from->table->s->blob_ptr_size;
652+
to_ptr+= to_length - portable_sizeof_char_ptr;
653+
from_ptr+= from_length - portable_sizeof_char_ptr;
654654
return do_copy_blob;
655655
}
656656
}

sql/sql_const.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@
7777

7878
/* Some portable defines */
7979

80-
#define portable_sizeof_char_ptr 8
8180
#define STRING_BUFFER_USUAL_SIZE 80
8281

8382
/* Memory allocated when parsing a statement / saving a statement */

sql/sql_insert.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3804,7 +3804,6 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
38043804
init_tmp_table_share(thd, &share, "", 0, "", "");
38053805

38063806
tmp_table.s->db_create_options=0;
3807-
tmp_table.s->blob_ptr_size= portable_sizeof_char_ptr;
38083807
tmp_table.s->db_low_byte_first=
38093808
test(create_info->db_type == myisam_hton ||
38103809
create_info->db_type == heap_hton);

sql/sql_tmp_table.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
614614
table->s= share;
615615
init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
616616
share->blob_field= blob_field;
617-
share->blob_ptr_size= portable_sizeof_char_ptr;
618617
share->db_low_byte_first=1; // True for HEAP and MyISAM
619618
share->table_charset= param->table_charset;
620619
share->primary_key= MAX_KEY; // Indicate no primary key
@@ -1276,7 +1275,6 @@ TABLE *create_duplicate_weedout_tmp_table(THD *thd,
12761275
table->s= share;
12771276
init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
12781277
share->blob_field= blob_field;
1279-
share->blob_ptr_size= portable_sizeof_char_ptr;
12801278
share->db_low_byte_first=1; // True for HEAP and MyISAM
12811279
share->table_charset= NULL;
12821280
share->primary_key= MAX_KEY; // Indicate no primary key
@@ -1496,7 +1494,6 @@ TABLE *create_virtual_tmp_table(THD *thd, List<Create_field> &field_list)
14961494
table->temp_pool_slot= MY_BIT_NONE;
14971495
share->blob_field= blob_field;
14981496
share->fields= field_count;
1499-
share->blob_ptr_size= portable_sizeof_char_ptr;
15001497
share->db_low_byte_first=1; // True for HEAP and MyISAM
15011498
setup_tmp_table_column_bitmaps(table, bitmaps);
15021499

@@ -1698,7 +1695,8 @@ bool create_myisam_tmp_table(TABLE *table, KEY *keyinfo,
16981695
seg->type=
16991696
((keyinfo->key_part[i].key_type & FIELDFLAG_BINARY) ?
17001697
HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2);
1701-
seg->bit_start= (uint8)(field->pack_length() - share->blob_ptr_size);
1698+
seg->bit_start= (uint8)(field->pack_length() -
1699+
portable_sizeof_char_ptr);
17021700
seg->flag= HA_BLOB_PART;
17031701
seg->length=0; // Whole blob in unique constraint
17041702
}

sql/table.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
930930
share->table_charset= default_charset_info;
931931
}
932932
share->db_record_offset= 1;
933-
if (db_create_options & HA_OPTION_LONG_BLOB_PTR)
934-
share->blob_ptr_size= portable_sizeof_char_ptr;
935933
/* Set temporarily a good value for db_low_byte_first */
936934
share->db_low_byte_first= test(legacy_db_type != DB_TYPE_ISAM);
937935
error=4;

sql/table.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ struct TABLE_SHARE
673673
enum tmp_table_type tmp_table;
674674

675675
uint ref_count; /* How many TABLE objects uses this */
676-
uint blob_ptr_size; /* 4 or 8 */
677676
uint key_block_size; /* create key_block_size, if used */
678677
uint null_bytes, last_null_bit_pos;
679678
uint fields; /* Number of fields */

0 commit comments

Comments
 (0)