mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-26724 Endless loop in json_escape_to_string upon ... empty string
Correctly handle empty string when [un]escaping JSON
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user