diff options
author | Ali Alzyod <ali198724@gmail.com> | 2020-06-22 16:54:51 +0900 |
---|---|---|
committer | WooHyun Jung <wh0705.jung@samsung.com> | 2020-06-22 16:54:51 +0900 |
commit | 1bbd03b7683dc6f163fff94130d017367178d0f1 (patch) | |
tree | c0b64db7608e6e9b92024b282a3fbba800c42f85 /src/tests | |
parent | e3e3d0cfe4d753782d0adc81a68e5cd7ca27c5b9 (diff) | |
download | efl-1bbd03b7683dc6f163fff94130d017367178d0f1.tar.gz |
eina_strbuf: resolve segfault when replace used with read_only buffer
Summary: when eina_strbuf_replace is used by read_only buffer, this will cause segfault (access invalid memory)
Reviewers: cedric
Reviewed By: cedric
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8757
Differential Revision: https://phab.enlightenment.org/D11989
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/eina/eina_test_strbuf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_strbuf.c b/src/tests/eina/eina_test_strbuf.c index add3ce0963..1d9f52c0d2 100644 --- a/src/tests/eina/eina_test_strbuf.c +++ b/src/tests/eina/eina_test_strbuf.c @@ -303,6 +303,16 @@ EFL_START_TEST(eina_test_strbuf_replace) fail_if(strlen(eina_strbuf_string_get(buf)) != eina_strbuf_length_get(buf)); fail_if(strcmp(eina_strbuf_string_get(buf), "baaaab")); + fail_if(eina_strbuf_replace_first(buf, "a", "b") == 0); + fail_if(strcmp(eina_strbuf_string_get(buf), "bbaaab")); + + eina_strbuf_free(buf); + + buf = eina_strbuf_manage_read_only_new_length("baaaab",6); + fail_if(!buf); + fail_if(eina_strbuf_replace_first(buf, "a", "b") == 0); + fail_if(strcmp(eina_strbuf_string_get(buf), "bbaaab")); + eina_strbuf_free(buf); } EFL_END_TEST |