Skip to content

Commit 7e730bd

Browse files
author
Steinar H. Gunderson
committed
Bug #31591391: FIX BASE BUG IN 5.7/5.6 TOO, OVERFLOW IN FIELD_ENUM::PACK()
Backport the fix for bug #29948029 (ASSERTION FAILURE IN __GNU_CXX::NEW_ALLOCATOR() AT EXT/NEW_ALLOCATOR.H) to 5.6 and 5.7. Change-Id: I1397de18a1932724facd1a974c56cbada25b9b25
1 parent 6fef5ad commit 7e730bd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sql/field.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2000, 2020, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -8857,7 +8857,7 @@ uchar *Field_enum::pack(uchar *to, const uchar *from,
88578857
switch (packlength)
88588858
{
88598859
case 1:
8860-
*to = *from;
8860+
if (max_length > 0) *to = *from;
88618861
DBUG_RETURN(to + 1);
88628862
case 2: DBUG_RETURN(pack_int16(to, from, low_byte_first));
88638863
case 3: DBUG_RETURN(pack_int24(to, from, low_byte_first));

sql/field.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef FIELD_INCLUDED
22
#define FIELD_INCLUDED
33

4-
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
4+
/* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
55
66
This program is free software; you can redistribute it and/or modify
77
it under the terms of the GNU General Public License, version 2.0,
@@ -1746,7 +1746,7 @@ class Field_tiny :public Field_num {
17461746
virtual uchar *pack(uchar* to, const uchar *from,
17471747
uint max_length, bool low_byte_first)
17481748
{
1749-
*to= *from;
1749+
if (max_length > 0) *to= *from;
17501750
return to + 1;
17511751
}
17521752

0 commit comments

Comments
 (0)