Skip to content

Commit

Permalink
suppress sanitizer warnings when writing invalid enums
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
  • Loading branch information
peterhillman authored and cary-ilm committed Aug 18, 2020
1 parent 023e879 commit 2da1302
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions OpenEXR/IlmImf/ImfDeepImageStateAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ template <>
void
DeepImageStateAttribute::writeValueTo
(OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
#if defined (__clang__)
// _value may be an invalid value, which the clang sanitizer reports
// as undefined behavior, even though the value is acceptable in this
// context.
__attribute__((no_sanitize ("undefined")))
#endif
{
unsigned char tmp = _value;
Xdr::write <StreamIO> (os, tmp);
Expand Down
6 changes: 6 additions & 0 deletions OpenEXR/IlmImf/ImfEnvmapAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ EnvmapAttribute::staticTypeName ()
template <>
void
EnvmapAttribute::writeValueTo (OPENEXR_IMF_INTERNAL_NAMESPACE::OStream &os, int version) const
#if defined (__clang__)
// _value may be an invalid value, which the clang sanitizer reports
// as undefined behavior, even though the value is acceptable in this
// context.
__attribute__((no_sanitize ("undefined")))
#endif
{
unsigned char tmp = _value;
Xdr::write <StreamIO> (os, tmp);
Expand Down

0 comments on commit 2da1302

Please sign in to comment.