Skip to content

Commit 67bee87

Browse files
committed
src/tree_edit.h: coverity fix - out-of-bounds access
1 parent 52fb10a commit 67bee87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/tree_edit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void *ly_realloc(void *ptr, size_t size);
148148
} \
149149
p__ = (char *)((LY_ARRAY_COUNT_TYPE*)(p__) + 1); \
150150
memcpy(&(ARRAY), &p__, sizeof p__); \
151-
if (ARRAY) { \
151+
if ((ARRAY) && (SIZE > 0)) { \
152152
memset(&(ARRAY)[*((LY_ARRAY_COUNT_TYPE*)(p__) - 1)], 0, (SIZE) * sizeof *(ARRAY)); \
153153
} \
154154
}

0 commit comments

Comments
 (0)