8000 Check that size is not 0 before calling memcpy. · coderforlife/ms-compress@f59818a · GitHub
[go: up one dir, main page]

Skip to content

Commit f59818a

Browse files
committed
Check that size is not 0 before calling memcpy.
1 parent 741130c commit f59818a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/mscomp/internal.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,12 @@ typedef const_byte* RESTRICT const_rest_bytes;
510510
for (;;) \
511511
{ \
512512
const size_t copy = MIN(state->in_needed, stream->in_avail); \
513-
memcpy(state->in + state->in_avail, stream->in, copy); \
514-
state->in_avail += copy; \
515-
state->in_needed -= copy; \
516-
ADVANCE_IN(stream, copy); \
513+
if (copy != 0) { \
514+
memcpy(state->in + state->in_avail, stream->in, copy); \
515+
state->in_avail += copy; \
516+
state->in_needed -= copy; \
517+
ADVANCE_IN(stream, copy); \
518+
} \
517519
OP \
518520
break; \
519521
} \

0 commit comments

Comments
 (0)
0