summaryrefslogtreecommitdiff
path: root/sql/opt_histogram_json.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-10-01 14:15:17 +0300
committerSergei Petrunia <psergey@askmonty.org>2022-01-19 18:10:11 +0300
commit5c709ef18c5b5d1b27ebc45199f35afd0959da6b (patch)
tree5931e4d7a074e16e25c34d553c84b2a84cd71205 /sql/opt_histogram_json.cc
parent61cd4f441210aa7d140831236598df28f3d03d5e (diff)
downloadmariadb-git-5c709ef18c5b5d1b27ebc45199f35afd0959da6b.tar.gz
MDEV-26724 Endless loop in json_escape_to_string upon ... empty string
Correctly handle empty string when [un]escaping JSON
Diffstat (limited to 'sql/opt_histogram_json.cc')
-rw-r--r--sql/opt_histogram_json.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/opt_histogram_json.cc b/sql/opt_histogram_json.cc
index dc56a32d000..385d5b1e4e6 100644
--- a/sql/opt_histogram_json.cc
+++ b/sql/opt_histogram_json.cc
@@ -41,7 +41,7 @@ static bool json_unescape_to_string(const char *val, int val_len, String* out)
(const uchar*)val + val_len,
&my_charset_utf8mb4_bin,
buf, buf + out->length());
- if (res > 0)
+ if (res >= 0)
{
out->length(res);
return false; // Ok
@@ -74,7 +74,7 @@ static bool json_escape_to_string(const char *val, int val_len, String* out)
(const uchar*)val + val_len,
&my_charset_utf8mb4_bin,
buf, buf + out->length());
- if (res > 0)
+ if (res >= 0)
{
out->length(res);
return false; // Ok