Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suppress clang undefined behavior sanitizer in EnvmapAttribute::copyValuesFrom() #806

Merged
merged 2 commits into from
Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions OpenEXR/IlmImf/ImfEnvmapAttribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,18 @@ EnvmapAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &is, int
_value = Envmap (tmp);
}

template <>
void
EnvmapAttribute::copyValueFrom (const OPENEXR_IMF_INTERNAL_NAMESPACE::Attribute &other)
#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
{
_value = cast(other).value();

}

OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_EXIT
4 changes: 3 additions & 1 deletion OpenEXR/IlmImf/ImfEnvmapAttribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ template <> IMF_EXPORT
void EnvmapAttribute::readValueFrom (OPENEXR_IMF_INTERNAL_NAMESPACE::IStream &,
int,
int);

template <> IMF_EXPORT
void
EnvmapAttribute::copyValueFrom (const OPENEXR_IMF_INTERNAL_NAMESPACE::Attribute &other);

OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT

Expand Down