Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LEFEBVREJP email
radix
Commits
1130911d
Commit
1130911d
authored
Nov 18, 2019
by
Norby, Tom
Browse files
Update array indices to prevent out of bounds.
parent
472f1d3e
Pipeline
#80442
passed with stages
in 44 minutes and 29 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
radixio/spectrumpcfstream.i.hh
View file @
1130911d
...
...
@@ -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
<
2
0
;
++
column
)
{
radix
(
" "
);
for
(
size_t
panel
=
0
;
panel
<
8
;
++
panel
)
{
for
(
size_t
mca
=
0
;
mca
<
8
;
++
mca
)
{
for
(
size_t
pair
=
0
;
pair
<
2
0
;
++
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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment