Commit f3d62e5d authored by Jim King's avatar Jim King Committed by Jørgen Lind
Browse files

fix bug where CalculateGatherSpacing may try to read past end of file

parent 8145c9b9
......@@ -141,6 +141,12 @@ public:
m_dataViewManager->retireAllDataViews();
}
int64_t
fileTraceCount() const
{
return m_numTraces;
}
private:
std::shared_ptr<DataViewManager>
m_dataViewManager;
......
......@@ -2283,7 +2283,7 @@ CalculateGatherSpacing(const SEGYFileInfo& fileInfo, const int fold, const std::
// read traces and stuff offset into a vector while primaryKey/secondaryKey match
int64_t
trace = firstTrace + 1;
for (int64_t trace = firstTrace + 1; trace < firstTrace + fold; ++trace)
for (int64_t trace = firstTrace + 1; trace < traceDataManager.fileTraceCount() && trace < firstTrace + fold; ++trace)
{
header = traceDataManager.getTraceData(trace, error);
if (error.code != 0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment