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

- Fix bug causing bnx base wrong after CheckMemory

Add negative array indexes starting from the last
  modified:   storage/connect/bson.cpp
  modified:   storage/connect/bsonudf.cpp
  modified:   storage/connect/json.cpp
This commit is contained in:
Olivier Bertrand
2021-02-05 11:55:47 +01:00
parent 571294f954
commit ca63004190
3 changed files with 18 additions and 3 deletions

View File

@@ -58,11 +58,19 @@ char *GetJsonNull(void);
/***********************************************************************/
/* IsNum: check whether this string is all digits. */
/***********************************************************************/
bool IsNum(PSZ s) {
for (char* p = s; *p; p++)
bool IsNum(PSZ s)
{
char* p = s;
if (*p == '-')
p++;
if (*p == ']')
return false;
else for (; *p; p++)
if (*p == ']')
break;
else if (!isdigit(*p) || *p == '-')
else if (!isdigit(*p))
return false;
return true;
@@ -1257,6 +1265,8 @@ PJVAL JARRAY::GetArrayValue(int i)
{
if (Mvals && i >= 0 && i < Size)
return Mvals[i];
else if (Mvals && i < 0 && i >= -Size)
return Mvals[Size + i];
else
return NULL;
} // end of GetValue