summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2021-03-23 13:23:37 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2021-04-21 10:21:44 +0400
commit46d592a047a6a9a062e07fe511a6164fd5ccfc22 (patch)
tree4ed63ef77a600cf81de77c5c9df568bfab4e0ab2 /sql/field.h
parent0eda81e4d964898db271e08a68ef9ea1760913e0 (diff)
downloadmariadb-git-46d592a047a6a9a062e07fe511a6164fd5ccfc22.tar.gz
MDEV-25188 JSON_TABLE: ASAN use-after-poison in Field_long::reset / Table_function_json_table::setup or malloc(): invalid size.
MDEV-25192 JSON_TABLE: ASAN use-after-poison in field_conv_memcpy / Create_tmp_table::finalize upon query with derived table.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h15
1 files changed, 5 insertions, 10 deletions
diff --git a/sql/field.h b/sql/field.h
index 557b0aaffa4..b312b10881f 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1612,7 +1612,7 @@ public:
virtual const TYPELIB *get_typelib() const { return NULL; }
virtual CHARSET_INFO *charset() const= 0;
/* returns TRUE if the new charset differs. */
- virtual bool change_charset(const DTCollation &new_cs) { return FALSE; }
+ virtual void change_charset(const DTCollation &new_cs) {}
virtual const DTCollation &dtcollation() const= 0;
virtual CHARSET_INFO *charset_for_protocol(void) const
{ return binary() ? &my_charset_bin : charset(); }
@@ -2111,16 +2111,11 @@ public:
{
return m_collation;
}
- bool change_charset(const DTCollation &new_cs) override
+ void change_charset(const DTCollation &new_cs) override
{
- if (m_collation.collation != new_cs.collation)
- {
- field_length= (field_length * new_cs.collation->mbmaxlen) /
- m_collation.collation->mbmaxlen;
- m_collation= new_cs;
- return TRUE;
- }
- return FALSE;
+ field_length= (field_length * new_cs.collation->mbmaxlen) /
+ m_collation.collation->mbmaxlen;
+ m_collation= new_cs;
}
bool binary() const override { return field_charset() == &my_charset_bin; }
uint32 max_display_length() const override { return field_length; }