forked from tarantool/tarantool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lua-yaml: encode malformed error messages in base64
If MP_ERROR contains an error message with invalid UTF-8 sequences, encode it in Base64 to obtain printable string. Closes tarantool#6781 Closes tarantool#6934 NO_DOC=bugfix
- Loading branch information
1 parent
17c58b5
commit d2773c5
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## bugfix/core | ||
|
||
* Fixed tarantool terminations on error messages with invalid UTF-8 | ||
sequences (gh-6781 and gh-6934). |
17 changes: 17 additions & 0 deletions
17
test/box-luatest/gh_6934_nonprintable_error_message_test.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
local console = require('console') | ||
local t = require('luatest') | ||
local g = t.group() | ||
|
||
-- Check that an error message with invalid UTF-8 sequences is encoded to Base64 | ||
|
||
g.test_bad_utf8_in_error_msg1 = function() | ||
local res = console.eval("box.error.new(box.error.ILLEGAL_PARAMS, 'bad: \x80')") | ||
local ref = "---\n- !!binary SWxsZWdhbCBwYXJhbWV0ZXJzLCBiYWQ6IIA=\n...\n" | ||
t.assert_equals(res, ref) | ||
end | ||
|
||
g.test_bad_utf8_in_error_msg2 = function() | ||
local res = console.eval("require('net.box').self:call('bad: \x8a')") | ||
local ref = "---\n- error: !!binary UHJvY2VkdXJlICdiYWQ6IIonIGlzIG5vdCBkZWZpbmVk\n...\n" | ||
t.assert_equals(res, ref) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters