summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2018-07-16 06:09:38 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-07-16 06:09:38 -0400
commit93397449d4051fe3f545660cc74aad38355dee55 (patch)
tree5519efde2893af62ec27aae76fa745996d4e0904 /src/lib/eina
parenta61786bd0e3a5508945d57d5aa5f55b68182e0b0 (diff)
Eina binbuf: add explicit null-check before magic-check
Summary: Using `--disable-magic-debug` defines EINA_MAGIC_CHECK to always evaluate to `1`. Eina_Binbuf's null-check relied solely on the EINA_MAGIC_CHECK, and failed to pick up on the cases where `buf` was passed as NULL. This has led to a segfault when a NULL `buf` was passed in the test suite (see referenced ticket). This fix adds an explicit NULL check. Fixes https://phab.enlightenment.org/T7147 Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #committers, zmike Tags: #efl Differential Revision: https://phab.enlightenment.org/D6592
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_strbuf_common.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lib/eina/eina_strbuf_common.h b/src/lib/eina/eina_strbuf_common.h
index 931cae456d..447cb47a74 100644
--- a/src/lib/eina/eina_strbuf_common.h
+++ b/src/lib/eina/eina_strbuf_common.h
@@ -25,6 +25,7 @@ struct _Eina_Strbuf
25 25
26#define EINA_MAGIC_CHECK_STRBUF(d, ...) \ 26#define EINA_MAGIC_CHECK_STRBUF(d, ...) \
27 do { \ 27 do { \
28 if (!(d)) return __VA_ARGS__; \
28 if (!EINA_MAGIC_CHECK((d), _STRBUF_MAGIC)) \ 29 if (!EINA_MAGIC_CHECK((d), _STRBUF_MAGIC)) \
29 { \ 30 { \
30 EINA_MAGIC_FAIL((d), _STRBUF_MAGIC); \ 31 EINA_MAGIC_FAIL((d), _STRBUF_MAGIC); \