Commit b3857c82 authored by Lefebvre, Jordan P's avatar Lefebvre, Jordan P

Merge branch 'spectrum_array_fix' into 'master'

Update array indices to prevent out of bounds.

See merge request !88
parents 472f1d3e 1130911d
Pipeline #80468 passed with stages
in 21 minutes and 18 seconds
......@@ -119,14 +119,14 @@ bool SpectrumPCFStream<data_type>::read_from(const std::string &file)
<< " bytes to beginning of pairs (@512 bytes)");
stream.skipBytes(512 - stream.bytesRead());
for (size_t column = 0; column < 2; ++column)
for (size_t column = 0; column < 20; ++column)
{
radix(" ");
for (size_t panel = 0; panel < 8; ++panel)
{
for (size_t mca = 0; mca < 8; ++mca)
{
for (size_t pair = 0; pair < 20; ++pair)
for (size_t pair = 0; pair < 2; ++pair)
{
float energy = stream.readFloat();
float offset = stream.readFloat();
......@@ -148,14 +148,14 @@ bool SpectrumPCFStream<data_type>::read_from(const std::string &file)
// Read compressed deviation pairs
// Move to beginning of pairs
stream.skipBytes(226);
for (size_t column = 0; column < 4; ++column)
for (size_t column = 0; column < 20; ++column)
{
radix(" ");
for (size_t panel = 0; panel < 8; ++panel)
{
for (size_t mca = 0; mca < 8; ++mca)
{
for (size_t pair = 0; pair < 20; ++pair)
for (size_t pair = 0; pair < 4; ++pair)
{
float energy = float(stream.readShort()) / 10.f;
float offset = float(stream.readShort()) / 10.f;
......
Markdown is supported
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