lib/core: add failsafe to UTF8Codec::decode_string
authorLucas Bajolet <lucas.bajolet@gmail.com>
Fri, 11 May 2018 00:50:14 +0000 (20:50 -0400)
committerLucas Bajolet <lucas.bajolet@gmail.com>
Fri, 11 May 2018 03:16:40 +0000 (23:16 -0400)
commit7129cc174da914bc4f88fdd5a01f177520c71815
tree68d3c3dd1c67b922bf5950e5daab9ce7e7562be5
parent8386ac8a0c7162bbd3d65f3ad119996e73ecd66d
lib/core: add failsafe to UTF8Codec::decode_string

Calling decode_string on the UTF-8 codec with a negative legth would
cause memmove to crash the program with a segfault.

Adding an assert gives more information on what went wrong and will help
investigate future bugs.

Signed-off-by: Lucas Bajolet <lucas.bajolet@gmail.com>
lib/core/codecs/utf8.nit