1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-36894 JSNX::SetArrayOptions and BJNX::SetArrayOptions unused nm arg

Calling SetArrayOptions with Nodes[i - 1].Key as its nm argument
exposed a MemorySanitizer error when i=0 for the tests:
* connect.bson_udf
* connect.json_udf
* connect.json_udf_bin

Its assumed that a basic optimization would have eliminated
these invalid expressions.

As the nm argument was unused, it has been removed.
This commit is contained in:
Daniel Black
2025-05-28 14:03:40 +10:00
parent 495153feac
commit 5dbfb52d04
4 changed files with 6 additions and 6 deletions

View File

@@ -191,7 +191,7 @@ my_bool BJNX::SetJpath(PGLOBAL g, char* path, my_bool jb)
/*********************************************************************************/
/* Analyse array processing options. */
/*********************************************************************************/
my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm)
my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i)
{
int n = (int)strlen(p);
my_bool dg = true, b = false;
@@ -339,7 +339,7 @@ my_bool BJNX::ParseJpath(PGLOBAL g)
// Jpath must be explicit
if (a || *p == 0 || *p == '[' || IsNum(p)) {
// Analyse intermediate array processing
if (SetArrayOptions(g, p, i, Nodes[i - 1].Key))
if (SetArrayOptions(g, p, i))
return true;
} else if (*p == '*') {

View File

@@ -116,7 +116,7 @@ public:
PBSON MakeBinResult(UDF_ARGS* args, PBVAL top, ulong len, int n = 2);
protected:
my_bool SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm);
my_bool SetArrayOptions(PGLOBAL g, char* p, int i);
PVAL GetColumnValue(PGLOBAL g, PBVAL row, int i);
PVAL ExpandArray(PGLOBAL g, PBVAL arp, int n);
PVAL CalculateArray(PGLOBAL g, PBVAL arp, int n);

View File

@@ -112,7 +112,7 @@ my_bool JSNX::SetJpath(PGLOBAL g, char *path, my_bool jb)
/*********************************************************************************/
/* Analyse array processing options. */
/*********************************************************************************/
my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i)
{
int n = (int)strlen(p);
my_bool dg = true, b = false;
@@ -262,7 +262,7 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
// Jpath must be explicit
if (a || *p == 0 || *p == '[' || IsNum(p)) {
// Analyse intermediate array processing
if (SetArrayOptions(g, p, i, Nodes[i-1].Key))
if (SetArrayOptions(g, p, i))
return true;
} else if (*p == '*') {

View File

@@ -330,7 +330,7 @@ public:
char *LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx = 10);
protected:
my_bool SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm);
my_bool SetArrayOptions(PGLOBAL g, char *p, int i);
PVAL GetColumnValue(PGLOBAL g, PJSON row, int i);
PVAL ExpandArray(PGLOBAL g, PJAR arp, int n);
PVAL GetCalcValue(PGLOBAL g, PJAR bap, int n);