Skip to content

Commit 36630d2

Browse files
committed
TRD: Base: Fix possible segfault
Returning -1 here leads to overflow indexing in mData, which is a possbile segfault. Just warning and returning 0 is safe enough here. Signed-off-by: Felix Schlepper <f3sch.git@outlook.com>
1 parent d8ef9c5 commit 36630d2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Detectors/TRD/base/include/TRDBase/PadParameters.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ int PadParameters<T>::getChannel(int col, int row) const
7474
return row + col * constants::NROWC0;
7575
} else if (mData.size() == constants::NROWC1 * constants::NCOLUMN) {
7676
return row + col * constants::NROWC1;
77-
} else {
78-
LOG(error) << "Wrong number of channels set: " << mData.size();
7977
}
80-
return -1;
78+
79+
LOG(error) << "Wrong number of channels set: " << mData.size();
80+
return 0;
8181
}
8282

8383
} // namespace trd

0 commit comments

Comments
 (0)