From 15ed83ba3a4da5aca9df44d7e67c4d8dd4cf776c Mon Sep 17 00:00:00 2001 From: Prasanna Thoguluva Rajendran Date: Tue, 30 Apr 2024 15:02:11 -0700 Subject: [PATCH 1/2] Update HexMesh.f90 fixed issue with intermediate integer overflow when writing files exceeding 2 GB --- Solver/src/libs/mesh/HexMesh.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Solver/src/libs/mesh/HexMesh.f90 b/Solver/src/libs/mesh/HexMesh.f90 index ffba3b967..cbe36f14b 100644 --- a/Solver/src/libs/mesh/HexMesh.f90 +++ b/Solver/src/libs/mesh/HexMesh.f90 @@ -2978,7 +2978,7 @@ subroutine HexMesh_SaveSolution(self, iter, time, name, saveGradients, saveSenso Q(NCONS,:,:,:) = e % storage % c(1,:,:,:) #endif - pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + padding*e % offsetIO * SIZEOF_RP + pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + 1_AddrInt*padding*e % offsetIO * SIZEOF_RP if (saveSensor) pos = pos + (e % globID - 1) * SIZEOF_RP call writeArray(fid, Q, position=pos) From 2101865221483e178bb5bc06b3866e0d1c8866c3 Mon Sep 17 00:00:00 2001 From: Prasanna Thoguluva Rajendran Date: Fri, 3 May 2024 11:32:50 -0700 Subject: [PATCH 2/2] fixed potential integer overflow in file read/write multiplied 1_AddrInt to wherever variable offsetIO is used --- Solver/src/libs/mesh/HexMesh.f90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Solver/src/libs/mesh/HexMesh.f90 b/Solver/src/libs/mesh/HexMesh.f90 index cbe36f14b..d9c2ae1c6 100644 --- a/Solver/src/libs/mesh/HexMesh.f90 +++ b/Solver/src/libs/mesh/HexMesh.f90 @@ -3078,7 +3078,7 @@ subroutine HexMesh_SaveStatistics(self, iter, time, name, saveGradients) fID = putSolutionFileInWriteDataMode(trim(name)) do eID = 1, self % no_of_elements associate( e => self % elements(eID) ) - pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + no_of_stats_variables*e % offsetIO*SIZEOF_RP + pos = POS_INIT_DATA + (e % globID-1)*5_AddrInt*SIZEOF_INT + 1_AddrInt*no_of_stats_variables*e % offsetIO*SIZEOF_RP no_stat_s = 9 call writeArray(fid, e % storage % stats % data(1:no_stat_s,:,:,:), position=pos) allocate(Q(NCONS, 0:e % Nxyz(1), 0:e % Nxyz(2), 0:e % Nxyz(3))) @@ -3374,7 +3374,7 @@ subroutine HexMesh_LoadSolution( self, fileName, initial_iteration, initial_time fID = putSolutionFileInReadDataMode(trim(fileName)) do eID = 1, size(self % elements) associate( e => self % elements(eID) ) - pos = POS_INIT_DATA + (e % globID-1)*5*SIZEOF_INT + padding*e % offsetIO*SIZEOF_RP + pos = POS_INIT_DATA + (e % globID-1)*5*SIZEOF_INT + 1_AddrInt*padding*e % offsetIO*SIZEOF_RP if (has_sensor) pos = pos + (e % globID - 1) * SIZEOF_RP read(fID, pos=pos) array_rank read(fID) no_of_eqs, Nxp1, Nyp1, Nzp1