diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2015-12-05 21:04:02 +0100 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2015-12-05 21:04:02 +0100 |
commit | d059dd736867f5260c7e1663ea09835055b556e0 (patch) | |
tree | 28849d35a8a1464448108e5be59c5899607e2862 /storage | |
parent | a6b8bfcafd71804244954ddd4f9cdd0fc4ba7e68 (diff) | |
download | mariadb-git-d059dd736867f5260c7e1663ea09835055b556e0.tar.gz |
Fix memory error when a plain string argument is parsed.
Parsing memory, not added in CalcLen, is added in CheckMemory.
Adding also the file length.
modified: storage/connect/jsonudf.cpp
Diffstat (limited to 'storage')
-rw-r--r-- | storage/connect/jsonudf.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 4fa21b84224..6aa82faf657 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -1426,10 +1426,11 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n, char *p = args->args[0]; // Is this a file name? - if (strchr("[{ \t\r\n", *p) || !(len = GetFileLength(p))) - len = args->lengths[0]; + if (!strchr("[{ \t\r\n", *p) && (len = GetFileLength(p))) + ml += len * (M + 1); + else + ml += args->lengths[0] * M; - ml += len * M; // Was not done in CalcLen } // endif b if (ml > g->Sarea_Size) { |