forked from enlightenment/efl
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
This commit is contained in:
parent
a61786bd0e
commit
93397449d4
|
@ -25,6 +25,7 @@ struct _Eina_Strbuf
|
||||||
|
|
||||||
#define EINA_MAGIC_CHECK_STRBUF(d, ...) \
|
#define EINA_MAGIC_CHECK_STRBUF(d, ...) \
|
||||||
do { \
|
do { \
|
||||||
|
if (!(d)) return __VA_ARGS__; \
|
||||||
if (!EINA_MAGIC_CHECK((d), _STRBUF_MAGIC)) \
|
if (!EINA_MAGIC_CHECK((d), _STRBUF_MAGIC)) \
|
||||||
{ \
|
{ \
|
||||||
EINA_MAGIC_FAIL((d), _STRBUF_MAGIC); \
|
EINA_MAGIC_FAIL((d), _STRBUF_MAGIC); \
|
||||||
|
|
Loading…
Reference in New Issue