We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7996ca6 commit ba7742aCopy full SHA for ba7742a
1 file changed
libhdt/src/util/Histogram.h
@@ -28,7 +28,7 @@ class Histogram {
28
29
Histogram() :
30
Start(0), nBins_by_interval(0), nBins(0),
31
- freq(new size_t[0]) {
+ freq(new size_t[1]) { // size_t[0] is undefined behavior
32
reset();
33
}
34
@@ -69,7 +69,7 @@ class Histogram {
69
delete[] freq;
70
71
72
- /** operator=
+ /** operator=
73
* Set this histogram equal to another.
74
* @param other Description of the param.
75
* @return The expected result.
@@ -81,9 +81,9 @@ class Histogram {
81
if (nBins != other.nBins) {
82
nBins = other.nBins;
83
84
- freq = new size_t[nBins];
+ freq = new size_t[nBins];
85
86
- for (size_t i(0); i < nBins; ++i)
+ for (size_t i(0); i < nBins; ++i)
87
freq[i] = other.freq[i];
88
89
return *this;
0 commit comments