diff options
author | Andrew Clayton <andrew@digital-domain.net> | 2022-06-15 19:59:57 +0100 |
---|---|---|
committer | Andrew Clayton <andrew@digital-domain.net> | 2022-06-15 19:59:57 +0100 |
commit | 68afb3efcf123f0a18119a02bfa18691e0e80253 (patch) | |
tree | 2e7956d70948772e5c8495d38bf942fc8eb81060 /CONTRIBUTING.md | |
parent | 6a8081d71e805b12d0f7fd32ce72d60babadfc85 (diff) | |
download | unit-archive/overlappingWriteUnion.tar.gz unit-archive/overlappingWriteUnion.tar.bz2 |
Sptr: avoided potentially undefined behaviour.archive/overlappingWriteUnion
In src/nxt_unit_sptr.h::nxt_unit_sptr_set() we are setting one member of
a union based on another member which cppcheck[0] flags as undefined
behaviour
src/nxt_unit_sptr.h:27:18: error: Overlapping read/write of union is undefined behavior [overlappingWriteUnion]
sptr->offset = (uint8_t *) ptr - sptr->base;
^
I think this warning is correct as I can't see where we are setting
sptr->base beforehand which I think would make this defined behaviour.
To avoid any doubts take a copy of sptr->base and then use that value in
the above.
[0]: https://cppcheck.sourceforge.io/
Diffstat (limited to 'CONTRIBUTING.md')
0 files changed, 0 insertions, 0 deletions