1
0
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

Part#3:
- make json_escape() return different errors on conversion error
  and on out-of-space condition.
- Make histogram code handle conversion errors.
This commit is contained in:
Sergei Petrunia
2021-10-10 11:51:04 +03:00
parent 8e0a342b91
commit 3936dc3353
6 changed files with 65 additions and 16 deletions

View File

@@ -81,7 +81,10 @@ static bool json_escape_to_string(const String *str, String* out)
return false; // Ok
}
// We get here if the escaped string didn't fit into memory.
if (res != JSON_ERROR_OUT_OF_SPACE)
return true; // Some conversion error
// Out of space error. Try with a bigger buffer
if (out->alloc(out->alloced_length()*2))
return true;
}