Skip to content
Snippets Groups Projects
Commit ffce9cb4 authored by Vladislav Shpilevoy's avatar Vladislav Shpilevoy
Browse files

fiber: extend name buffer on 1 byte for \0

Checks for fiber_name legth worked with FIBER_NAME_MAX,
while one byte in fact was occupied by terminating zero.

Closes #4011
parent 79bd523e
No related branches found
No related tags found
No related merge requests found
......@@ -417,7 +417,7 @@ struct fiber {
struct ipc_wait_pad *wait_pad;
/** Exception which caused this fiber's death. */
struct diag diag;
char name[FIBER_NAME_MAX];
char name[FIBER_NAME_MAX + 1];
};
enum { FIBER_CALL_STACK = 16 };
......
......@@ -1186,7 +1186,7 @@ fiber = nil
---
...
--
-- gh-2622 fiber.name() truncates new name
-- gh-2622, gh-4011: fiber.name() truncates new name.
--
fiber = require('fiber')
---
......@@ -1214,14 +1214,14 @@ fiber.name(long_name, {truncate = true})
...
fiber.name()
---
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
f = fiber.self()
---
...
fiber.name(f)
---
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
fiber.name(f, 'new_name')
---
......@@ -1239,7 +1239,7 @@ fiber.name(f, long_name, {truncate = true})
...
fiber.name(f)
---
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
...
--
-- gh-3493 fiber.create() does not roll back memtx transaction
......
......@@ -504,7 +504,7 @@ test_run:cmd("setopt delimiter ''");
fiber = nil
--
-- gh-2622 fiber.name() truncates new name
-- gh-2622, gh-4011: fiber.name() truncates new name.
--
fiber = require('fiber')
long_name = string.rep('a', 300)
......
......@@ -5,7 +5,7 @@ SystemError Failed to allocate 42 bytes in allocator for exception: Cannot alloc
# set new fiber name: Horace.
# fiber name is truncated: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
# fiber name is truncated: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.
*** fiber_name_test: done ***
*** fiber_join_test ***
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment