Using gcc-15 on ubuntu linux on x64, compiling the source(?) for
wsjtx 2.7.0 using -fsanitize=undefined (the so-called "ubsan") there's an
off by one error indexing
a static local array.
See attached md file, which contains source code listing and my asking gdb
for values of various expressions.
There's occasionally an off by one error indexing a
static local variable in `WideGraph::dataSink2`.
[Is this code thread safe? should it be?]
```
/home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/widgets/widegraph.cpp:182:27: runtime error: index 6827 out of bounds for type 'float [6827]'
174 int i=int(ui->widePlot->startFreq()/df3 + 0.5);
175 int jz=5000.0/(nbpp*df3);
176 if(jz>MAX_SCREENSIZE) jz=MAX_SCREENSIZE;
177 m_jz=jz;
178 for (int j=0; j<jz; j++) {
179 float ss=0.0;
180 float smax=0;
181 for (int k=0; k<nbpp; k++) {
182 float sp=splot[i++];
183 ss += sp;
184 smax=qMax(smax,sp);
185 }
186 // m_swide[j]=nbpp*smax;
187 m_swide[j]=nbpp*ss;
188 }
print ui->widePlot->startFreq()
$12 = 400
print df3
$13 = 0.732421875
ptype splot
type = float [6827]
// static float splot[NSMAX];
```
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel