Skip to content

Commit 641bd2f

Browse files
authored
Fix potential segfault in COORDS DataSet (#916)
* Protect when output frame does not have remd indices allocated. * Revision bump for fix of potential segfault in DataSet_Coords_CRD.cpp.
1 parent 64c9023 commit 641bd2f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/DataSet_Coords_CRD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static inline void ArrayToFrame(int idx, Frame& fOut, CompactFrameArray const& f
125125
if (frames_.HasComponent(CoordinateInfo::REDOX)) fOut.SetRedOx(frames_.GetVal(idx, CoordinateInfo::REDOX));
126126
if (frames_.HasComponent(CoordinateInfo::TIME)) fOut.SetTime(frames_.GetVal(idx, CoordinateInfo::TIME));
127127
if (frames_.HasComponent(CoordinateInfo::STEP)) fOut.SetStep(frames_.GetVal(idx, CoordinateInfo::STEP));
128-
if (frames_.HasComponent(CoordinateInfo::REMD_INDICES)) frames_.GetToIntPtr(fOut.iAddress(), idx, CoordinateInfo::REMD_INDICES);
128+
if (frames_.HasComponent(CoordinateInfo::REMD_INDICES) && !fOut.RemdIndices().empty()) frames_.GetToIntPtr(fOut.iAddress(), idx, CoordinateInfo::REMD_INDICES);
129129
if (frames_.HasComponent(CoordinateInfo::REPIDX)) fOut.SetRepIdx(frames_.GetVal(idx, CoordinateInfo::REPIDX));
130130
if (frames_.HasComponent(CoordinateInfo::CRDIDX)) fOut.SetCrdIdx(frames_.GetVal(idx, CoordinateInfo::CRDIDX));
131131
}

src/Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Whenever a number that precedes <revision> is incremented, all subsequent
1313
* numbers should be reset to 0.
1414
*/
15-
#define CPPTRAJ_INTERNAL_VERSION "V5.4.1"
15+
#define CPPTRAJ_INTERNAL_VERSION "V5.4.2"
1616
/// PYTRAJ relies on this
1717
#define CPPTRAJ_VERSION_STRING CPPTRAJ_INTERNAL_VERSION
1818
#endif

0 commit comments

Comments
 (0)