From f4659b2b0c00ae4e8395984dedec576a68042cd9 Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@openairinterface.org>
Date: Sun, 2 Jun 2024 11:35:47 +0200
Subject: [PATCH] Fix integer overflow

Avoid UBSan error:
  openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c:183:22: runtime error: signed integer overflow: 2122747784 + 27403601 cannot be represented in type 'int'
---
 openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
index ded4ece6527..061cb93d044 100644
--- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
+++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
@@ -162,7 +162,7 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
     } //rb
   } // symb
   int nb_rb=0;
-  int32_t n0_subband_tot=0;
+  int64_t n0_subband_tot=0;
   int32_t n0_subband_tot_perANT[frame_parms->nb_antennas_rx];
 
   memset(n0_subband_tot_perANT, 0, sizeof(n0_subband_tot_perANT));
-- 
GitLab