mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #19688008 CREATE_ASYMMETRIC_PUB_KEY: CRASHES IN OPENSSL
CODE 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.
This commit is contained in:
@ -3351,8 +3351,12 @@ bool udf_handler::get_arguments()
|
|||||||
{
|
{
|
||||||
f_args.args[i]= (char*) res->ptr();
|
f_args.args[i]= (char*) res->ptr();
|
||||||
f_args.lengths[i]= res->length();
|
f_args.lengths[i]= res->length();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f_args.lengths[i]= 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case INT_RESULT:
|
case INT_RESULT:
|
||||||
*((longlong*) to) = args[i]->val_int();
|
*((longlong*) to) = args[i]->val_int();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -295,9 +295,20 @@ char *metaphon(UDF_INIT *initid __attribute__((unused)),
|
|||||||
|
|
||||||
if (!word) /* Null argument */
|
if (!word) /* Null argument */
|
||||||
{
|
{
|
||||||
|
/* The length is expected to be zero when the argument is NULL. */
|
||||||
|
assert(args->lengths[0] == 0);
|
||||||
*is_null=1;
|
*is_null=1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
A check to confirm that argument length has the value it is
|
||||||
|
expected to have.
|
||||||
|
*/
|
||||||
|
assert(strlen(word) == args->lengths[0]);
|
||||||
|
}
|
||||||
|
|
||||||
w_end=word+args->lengths[0];
|
w_end=word+args->lengths[0];
|
||||||
org_result=result;
|
org_result=result;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user