diff options
author | Adam Stylinski <kungfujesus06@gmail.com> | 2022-03-17 20:22:56 -0400 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2023-03-17 21:27:56 +0100 |
commit | 46ebafe73f2aff8da6cc28a04922dbba5935017f (patch) | |
tree | 607f77228a03ad281220925003e16bc9d29573a3 | |
parent | 96abcdb73f767361944cb258eeaf86738c4ceb78 (diff) |
Fix a latent issue with chunkmemset
It would seem that on some platforms, namely those which are
!UNALIGNED64_OK, there was a likelihood of chunkmemset_safe_c copying all
the bytes before passing control flow to chunkcopy, a function which is
explicitly unsafe to be called with a zero length copy.
This fixes that bug for those platforms.
-rw-r--r-- | chunkset_tpl.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/chunkset_tpl.h b/chunkset_tpl.h index be52ee9..68728d4 100644 --- a/chunkset_tpl.h +++ b/chunkset_tpl.h @@ -200,5 +200,8 @@ Z_INTERNAL uint8_t* CHUNKMEMSET_SAFE(uint8_t *out, unsigned dist, unsigned len, } return out; } - return CHUNKMEMSET(out, dist, len); + if (len) + return CHUNKMEMSET(out, dist, len); + + return out; } |