From 0c19d1ea03a60139d5dc29f85f967c039e5553cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 21 May 2019 12:29:37 +0300 Subject: [PATCH] Fix debug assertion in mysql_backend The backend read function used a NULL GWBUF with gwbuf_length. --- .../protocol/MySQL/mariadbbackend/mysql_backend.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc index ecf4b8d46..b2f50777b 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc @@ -788,7 +788,7 @@ static int gw_read_and_write(DCB* dcb) { GWBUF* read_buffer = NULL; MXS_SESSION* session = dcb->session; - int nbytes_read; + int nbytes_read = 0; int return_code = 0; /* read available backend data */ @@ -800,7 +800,11 @@ static int gw_read_and_write(DCB* dcb) return 0; } - nbytes_read = gwbuf_length(read_buffer); + if (read_buffer) + { + nbytes_read = gwbuf_length(read_buffer); + } + if (nbytes_read == 0) { mxb_assert(read_buffer == NULL);