Skip to content

Commit 271fed4

Browse files
committed
Merge branch '5.5' into 10.0
2 parents ff26d93 + e1385f2 commit 271fed4

File tree

116 files changed

+2625
-533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2625
-533
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ include/mysql_version.h
5959
include/mysqld_ername.h
6060
include/mysqld_error.h
6161
include/sql_state.h
62+
include/probes_mysql.d
63+
include/probes_mysql_dtrace.h
64+
include/probes_mysql_nodtrace.h
6265
info_macros.cmake
6366
libmysql*/libmysql*_exports_file.cc
6467
libmysql*/merge_archives_mysql*.cmake

client/mysql_upgrade.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ static const char *load_default_groups[]=
184184
static void free_used_memory(void)
185185
{
186186
/* Free memory allocated by 'load_defaults' */
187-
free_defaults(defaults_argv);
187+
if (defaults_argv)
188+
free_defaults(defaults_argv);
188189

189190
dynstr_free(&ds_args);
190191
dynstr_free(&conn_args);
@@ -1096,7 +1097,6 @@ int main(int argc, char **argv)
10961097
if (opt_systables_only && !opt_silent)
10971098
printf("The --upgrade-system-tables option was used, user tables won't be touched.\n");
10981099

1099-
11001100
/*
11011101
Read the mysql_upgrade_info file to check if mysql_upgrade
11021102
already has been run for this installation of MySQL

cmake/dtrace.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ IF(ENABLE_DTRACE)
8686
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
8787
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
8888
)
89+
ELSE()
90+
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/probes_mysql_nodtrace.h.in
91+
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h COPYONLY)
8992
ENDIF()
9093

9194
FUNCTION(DTRACE_INSTRUMENT target)

configure.cmake

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,16 +790,36 @@ ENDIF()
790790
#
791791
# Test for how the C compiler does inline, if at all
792792
#
793+
# SunPro is weird, apparently it only supports inline at -xO3 or -xO4.
794+
# And if CMAKE_C_FLAGS has -xO4 but CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE} has -xO2
795+
# then CHECK_C_SOURCE_COMPILES will succeed but the built will fail.
796+
# We must test all flags here.
797+
# XXX actually, we can do this for all compilers, not only SunPro
798+
IF (CMAKE_CXX_COMPILER_ID MATCHES "SunPro" AND
799+
CMAKE_GENERATOR MATCHES "Makefiles")
800+
STRING(TOUPPER "CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE}" flags)
801+
SET(CMAKE_REQUIRED_FLAGS "${${flags}}")
802+
ENDIF()
793803
CHECK_C_SOURCE_COMPILES("
794-
static inline int foo(){return 0;}
804+
extern int bar(int x);
805+
static inline int foo(){return bar(1);}
795806
int main(int argc, char *argv[]){return 0;}"
796807
C_HAS_inline)
797808
IF(NOT C_HAS_inline)
798809
CHECK_C_SOURCE_COMPILES("
799-
static __inline int foo(){return 0;}
810+
extern int bar(int x);
811+
static __inline int foo(){return bar(1);}
800812
int main(int argc, char *argv[]){return 0;}"
801813
C_HAS___inline)
802-
SET(C_INLINE __inline)
814+
IF(C_HAS___inline)
815+
SET(C_INLINE __inline)
816+
ElSE()
817+
SET(C_INLINE)
818+
MESSAGE(WARNING "C compiler does not support funcion inlining")
819+
IF(NOT NOINLINE)
820+
MESSAGE(FATAL_ERROR "Use -DNOINLINE=TRUE to allow compilation without inlining")
821+
ENDIF()
822+
ENDIF()
803823
ENDIF()
804824

805825
IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)

extra/yassl/README

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ before calling SSL_new();
1212

1313
*** end Note ***
1414

15+
yaSSL Release notes, version 2.3.9 (12/01/2015)
16+
This release of yaSSL fixes two client side Diffie-Hellman problems.
17+
yaSSL was only handling the cases of zero or one leading zeros for the key
18+
agreement instead of potentially any number. This caused about 1 in 50,000
19+
connections to fail when using DHE cipher suites. The second problem was
20+
the case where a server would send a public value shorter than the prime
21+
value, causing about 1 in 128 client connections to fail, and also
22+
caused the yaSSL client to read off the end of memory. All client side
23+
DHE cipher suite users should update.
24+
Thanks to Adam Langely (agl@imperialviolet.org) for the detailed report!
25+
1526
yaSSL Release notes, version 2.3.8 (9/17/2015)
1627
This release of yaSSL fixes a high security vulnerability. All users
1728
SHOULD update. If using yaSSL for TLS on the server side with private

extra/yassl/include/crypto_wrapper.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ class DiffieHellman {
378378

379379
uint get_agreedKeyLength() const;
380380
const byte* get_agreedKey() const;
381+
uint get_publicKeyLength() const;
381382
const byte* get_publicKey() const;
382383
void makeAgreement(const byte*, unsigned int);
383384

extra/yassl/include/openssl/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "rsa.h"
3535

3636

37-
#define YASSL_VERSION "2.3.8"
37+
#define YASSL_VERSION "2.3.9"
3838

3939

4040
#if defined(__cplusplus)

extra/yassl/src/crypto_wrapper.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,10 @@ struct DiffieHellman::DHImpl {
751751
byte* publicKey_;
752752
byte* privateKey_;
753753
byte* agreedKey_;
754+
uint pubKeyLength_;
754755

755756
DHImpl(TaoCrypt::RandomNumberGenerator& r) : ranPool_(r), publicKey_(0),
756-
privateKey_(0), agreedKey_(0) {}
757+
privateKey_(0), agreedKey_(0), pubKeyLength_(0) {}
757758
~DHImpl()
758759
{
759760
ysArrayDelete(agreedKey_);
@@ -762,7 +763,7 @@ struct DiffieHellman::DHImpl {
762763
}
763764

764765
DHImpl(const DHImpl& that) : dh_(that.dh_), ranPool_(that.ranPool_),
765-
publicKey_(0), privateKey_(0), agreedKey_(0)
766+
publicKey_(0), privateKey_(0), agreedKey_(0), pubKeyLength_(0)
766767
{
767768
uint length = dh_.GetByteLength();
768769
AllocKeys(length, length, length);
@@ -810,7 +811,7 @@ DiffieHellman::DiffieHellman(const byte* p, unsigned int pSz, const byte* g,
810811
using TaoCrypt::Integer;
811812

812813
pimpl_->dh_.Initialize(Integer(p, pSz).Ref(), Integer(g, gSz).Ref());
813-
pimpl_->publicKey_ = NEW_YS opaque[pubSz];
814+
pimpl_->publicKey_ = NEW_YS opaque[pimpl_->pubKeyLength_ = pubSz];
814815
memcpy(pimpl_->publicKey_, pub, pubSz);
815816
}
816817

@@ -869,6 +870,10 @@ const byte* DiffieHellman::get_agreedKey() const
869870
return pimpl_->agreedKey_;
870871
}
871872

873+
uint DiffieHellman::get_publicKeyLength() const
874+
{
875+
return pimpl_->pubKeyLength_;
876+
}
872877

873878
const byte* DiffieHellman::get_publicKey() const
874879
{

extra/yassl/src/yassl_imp.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,12 @@ void ClientDiffieHellmanPublic::build(SSL& ssl)
109109
uint keyLength = dhClient.get_agreedKeyLength(); // pub and agree same
110110

111111
alloc(keyLength, true);
112-
dhClient.makeAgreement(dhServer.get_publicKey(), keyLength);
112+
dhClient.makeAgreement(dhServer.get_publicKey(),
113+
dhServer.get_publicKeyLength());
113114
c16toa(keyLength, Yc_);
114115
memcpy(Yc_ + KEY_OFFSET, dhClient.get_publicKey(), keyLength);
115116

116-
// because of encoding first byte might be zero, don't use it for preMaster
117-
if (*dhClient.get_agreedKey() == 0)
118-
ssl.set_preMaster(dhClient.get_agreedKey() + 1, keyLength - 1);
119-
else
120-
ssl.set_preMaster(dhClient.get_agreedKey(), keyLength);
117+
ssl.set_preMaster(dhClient.get_agreedKey(), keyLength);
121118
}
122119

123120

@@ -321,11 +318,7 @@ void ClientDiffieHellmanPublic::read(SSL& ssl, input_buffer& input)
321318
}
322319
dh.makeAgreement(Yc_, keyLength);
323320

324-
// because of encoding, first byte might be 0, don't use for preMaster
325-
if (*dh.get_agreedKey() == 0)
326-
ssl.set_preMaster(dh.get_agreedKey() + 1, dh.get_agreedKeyLength() - 1);
327-
else
328-
ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength());
321+
ssl.set_preMaster(dh.get_agreedKey(), dh.get_agreedKeyLength());
329322
ssl.makeMasterSecret();
330323
}
331324

extra/yassl/src/yassl_int.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,19 @@ void SSL::set_random(const opaque* random, ConnectionEnd sender)
807807
// store client pre master secret
808808
void SSL::set_preMaster(const opaque* pre, uint sz)
809809
{
810+
uint i(0); // trim leading zeros
811+
uint fullSz(sz);
812+
813+
while (i++ < fullSz && *pre == 0) {
814+
sz--;
815+
pre++;
816+
}
817+
818+
if (sz == 0) {
819+
SetError(bad_input);
820+
return;
821+
}
822+
810823
secure_.use_connection().AllocPreSecret(sz);
811824
memcpy(secure_.use_connection().pre_master_secret_, pre, sz);
812825
}
@@ -924,6 +937,8 @@ void SSL::order_error()
924937
// Create and store the master secret see page 32, 6.1
925938
void SSL::makeMasterSecret()
926939
{
940+
if (GetError()) return;
941+
927942
if (isTLS())
928943
makeTLSMasterSecret();
929944
else {

include/my_global.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,6 @@
200200
#define likely(x) __builtin_expect(((x) != 0),1)
201201
#define unlikely(x) __builtin_expect(((x) != 0),0)
202202

203-
/*
204-
now let's figure out if inline functions are supported
205-
autoconf defines 'inline' to be empty, if not
206-
*/
207-
#define inline_test_1(X) X ## 1
208-
#define inline_test_2(X) inline_test_1(X)
209-
#if inline_test_2(inline) != 1
210-
#define HAVE_INLINE
211-
#else
212-
#error Compiler does not support inline!
213-
#endif
214-
#undef inline_test_2
215-
#undef inline_test_1
216-
217203
/* Fix problem with S_ISLNK() on Linux */
218204
#if defined(TARGET_OS_LINUX) || defined(__GLIBC__)
219205
#undef _GNU_SOURCE
@@ -454,7 +440,7 @@ extern "C" int madvise(void *addr, size_t len, int behav);
454440
#endif
455441

456442
#ifndef STDERR_FILENO
457-
#define STDERR_FILENO 2
443+
#define STDERR_FILENO fileno(stderr)
458444
#endif
459445

460446
/*
File renamed without changes.

include/welcome_copyright_notice.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates.
2-
Copyright (c) 2011, 2015, MariaDB
1+
/* Copyright (c) 2011, 2016, Oracle and/or its affiliates.
2+
Copyright (c) 2011, 2016, MariaDB
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 as published by
@@ -17,7 +17,7 @@
1717
#ifndef _welcome_copyright_notice_h_
1818
#define _welcome_copyright_notice_h_
1919

20-
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2015"
20+
#define COPYRIGHT_NOTICE_CURRENT_YEAR "2016"
2121

2222
/*
2323
This define specifies copyright notice which is displayed by every MySQL

mysql-test/r/create.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,5 +2662,21 @@ Warnings:
26622662
Note 1291 Column 'a' has duplicated value '' in ENUM
26632663
drop table t1;
26642664
set @@session.collation_server=default;
2665+
#
2666+
# MDEV-7765: Crash (Assertion `!table || (!table->write_set ||
2667+
# bitmap_is_set(table->write_set, field_index) ||
2668+
# bitmap_is_set(table->vcol_set, field_index))' fails)
2669+
# on using function over not created table
2670+
#
2671+
CREATE function f1() returns int
2672+
BEGIN
2673+
declare n int;
2674+
set n:= (select count(*) from t1);
2675+
return n;
2676+
end|
2677+
create table t1 as select f1();
2678+
ERROR 42S02: Table 'test.t1' doesn't exist
2679+
drop function f1;
2680+
End of 5.5 tests
26652681
create table t1;
26662682
ERROR 42000: A table must have at least 1 column

mysql-test/r/ctype_utf8.result

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is a test
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b
@@ -5370,9 +5370,10 @@ SET sql_mode=default;
53705370
SET NAMES utf8;
53715371
CREATE TABLE t1 (a INT);
53725372
INSERT INTO t1 VALUES (0), (0), (1), (0), (0);
5373-
SELECT COUNT(*) FROM t1, t1 t2
5373+
SELECT COUNT(*) FROM t1, t1 t2
53745374
GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
5375-
ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key'
5375+
COUNT(*)
5376+
25
53765377
DROP TABLE t1;
53775378
#
53785379
# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters

mysql-test/r/ctype_utf8mb4.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is a test
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/ctype_utf8mb4_heap.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is a test
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/ctype_utf8mb4_innodb.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is a test
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

mysql-test/r/ctype_utf8mb4_myisam.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
116116
DROP TABLE t1;
117117
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
118118
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
119-
this is a test
119+
this is test
120120
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
121121
insert("aa",100,1,"b") insert("aa",1,3,"b")
122122
aa b

0 commit comments

Comments
 (0)