From 2829a8ce05d7b8428a21b0bd826e2687bcbd0afe Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Mon, 14 Sep 2015 21:20:22 +0300 Subject: [PATCH] Added missing check for empty result set in binlogrouter. --- server/modules/routing/binlog/blr_master.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/modules/routing/binlog/blr_master.c b/server/modules/routing/binlog/blr_master.c index 0a80a4d54..3001b2cef 100644 --- a/server/modules/routing/binlog/blr_master.c +++ b/server/modules/routing/binlog/blr_master.c @@ -1480,6 +1480,14 @@ char *rval; // Finally we have reached the row len = EXTRACT24(ptr); ptr += 4; + + /** The first EOF packet signals the start of the resultset rows and the second + EOF packet signals the end of the result set. If the resultset + contains a second EOF packet right after the first one, the result set is empty and + contains no rows. */ + if(len == 5 && *ptr == 0xfe) + return NULL; + while (--col > 0) { collen = *ptr++;