diff options
author | Andrew Clayton <andrew@digital-domain.net> | 2022-06-14 00:53:22 +0100 |
---|---|---|
committer | Andrew Clayton <andrew@digital-domain.net> | 2022-06-15 21:14:02 +0100 |
commit | 82f7d929bc242061be52d1d6a6f1a926a16da62f (patch) | |
tree | 0832898ed1288467fc3dd71045e4bdcf86ba029e /pkg/shasum.mak | |
parent | 6a8081d71e805b12d0f7fd32ce72d60babadfc85 (diff) | |
download | unit-archive/arithOperationsOnVoidPointer.tar.gz unit-archive/arithOperationsOnVoidPointer.tar.bz2 |
Array: avoided void pointer arithmetic in nxt_array_copy().archive/arithOperationsOnVoidPointer
As was pointed out by the cppcheck[0] static code analysis utility we
were doing void pointer arithmetic on src->elts which is technically
undefined behaviour.
While GCC allows this by treating the size of void as 1[1]. Same with
Clang. Other compilers I'm not sure about, so lets just be safe and cast
src->nelts to (char *) where sizeof(char) is guaranteed to be 1.
[0]: https://cppcheck.sourceforge.io/
[1]: https://gcc.gnu.org/onlinedocs/gcc/Pointer-Arith.html
Diffstat (limited to 'pkg/shasum.mak')
0 files changed, 0 insertions, 0 deletions