Skip to content

Commit

Permalink
Merge pull request #9470 from cms-sw/vdt-ubsan-integer-overflow
Browse files Browse the repository at this point in the history
[vdt]Apply patch to avoid UBSan signed integer overflow error
  • Loading branch information
smuzaffar authored Oct 19, 2024
2 parents 853f4f9 + 9af2fb8 commit deaac87
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
24 changes: 24 additions & 0 deletions vdt-integer-overflow.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/include/sincos.h b/include/sincos.h
index 563ae93..e5708c5 100644
--- a/include/sincos.h
+++ b/include/sincos.h
@@ -129,6 +129,9 @@ inline void fast_sincos_m45_45( const double z, double & s, double &c ) {
} // End namespace details

/// Double precision sincos
+#ifdef CMS_UNDEFINED_SANITIZER
+__attribute__((no_sanitize("signed-integer-overflow")))
+#endif
inline void fast_sincos( const double xx, double & s, double &c ) {
// I have to use doubles to make it vectorise...

@@ -204,6 +207,9 @@ inline void fast_sincosf_m45_45( const float x, float & s, float &c ) {
} // end details namespace

/// Single precision sincos
+#ifdef CMS_UNDEFINED_SANITIZER
+__attribute__((no_sanitize("signed-integer-overflow")))
+#endif
inline void fast_sincosf( const float xx, float & s, float &c ) {


6 changes: 4 additions & 2 deletions vdt.spec
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
### RPM cms vdt 0.4.3

Source: https://github.com/dpiparo/%{n}/archive/v%{realversion}.tar.gz

Source: https://github.com/dpiparo/%{n}/archive/v%{realversion}.tar.gz
# To avoid UBSan runtime errors about signed integer overflow: cms-sw/cmssw#46417
Patch0: vdt-integer-overflow
BuildRequires: cmake python3


%define keep_archives true

%prep
%setup -q -n %{n}-%{realversion}
%patch0 -p1

%build
cmake . \
Expand Down

0 comments on commit deaac87

Please sign in to comment.