Closed LubuntuSharp closed 4 years ago
ok, from data flow it shouldn't happen:
unsigned HantekDsoControl::getRecordLength() const {
unsigned rawsize = SAMPLESIZE_USED; // = 20000
rawsize *= this->downsamplingNumber; // take more samples
rawsize = ( (rawsize + 1024) / 1024 + 2 ) * 1024; // adjust for skipping of minimal 2018 leading samples
//printf( "getRecordLength: %d\n", rawsize );
return rawsize;
}
...
const unsigned rawSampleCount = unsigned( isFastRate() ? rawData.size() : (rawData.size() / 2) );
//printf("cRDTS, rawSampleCount %lu\n", rawSampleCount);
if ( 0 == rawSampleCount) // nothing to convert
return;
...
unsigned sampleCount = (rawSampleCount > 1024) ? ((rawSampleCount - 1024)/1000 - 1)*1000 : rawSampleCount;
...
unsigned rawDownsampling = sampleCount / SAMPLESIZE_USED;
....
result.data[channel].resize( sampleCount / rawDownsampling );
but I've included more safeguarding with a933b52
Describe the bug A division by zero comes out
To Reproduce GDB SHOWS OpenHantek6022-3.0.3/openhantek/src/hantekdso/hantekdsocontrol.cpp LINE 549 result.data[channel].resize( sampleCount / rawDownsampling ); rawDownsampling can happen to be equal to zero at run-time (I solved by defaulting resize argument to 1 instead of getting division by zero)
System info:
Scope device (please complete the following information):
Additional context I run with --useGLES option