From 3c02e6ec2efdb03b055d317ae596fc0c2da31e04 Mon Sep 17 00:00:00 2001 From: Vamsikrishna Bhagi Date: Wed, 25 Mar 2015 15:28:55 +0530 Subject: [PATCH] Bug# 20730103 BACKPORT 19688008 TO 5.1 Problem: UDF doesn't handle the arguments properly when they are of string type due to a misplaced break. The length of arguments is also not set properly when the argument is NULL. Solution: Fixed the code by putting the break at right place and setting the argument length to zero when the argument is NULL. --- sql/item_func.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sql/item_func.cc b/sql/item_func.cc index fd098f347d1..2c3094596eb 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3029,8 +3029,12 @@ bool udf_handler::get_arguments() { f_args.args[i]= (char*) res->ptr(); f_args.lengths[i]= res->length(); - break; } + else + { + f_args.lengths[i]= 0; + } + break; } case INT_RESULT: *((longlong*) to) = args[i]->val_int();