Closed gvanem closed 2 years ago
It's not an alignment issue after all. But that i
becomes negative:
for (int i = 0; i < count; i++) {
if (syncing) {
// If sync broken, reset sync
if ((_in->readBuf[i] > 0.0f) && !KGSSTV_SYNC_WORD[match]) {
if (++err > 4) {
i -= match - 1; // here
match = 0;
err = 0;
continue;
}
}
causing an illegal read of address _in->readBuf[i]
.
A fix for me was to patch:
--- a/decoder_modules/kg_sstv_decoder/src/kg_sstv_dsp.h 2022-04-02 13:22:49
+++ b/decoder_modules/kg_sstv_decoder/src/kg_sstv_dsp.h 2022-04-26 12:20:51
@@ -142,7 +142,7 @@
int count = _in->read();
if (count < 0) { return -1; }
- for (int i = 0; i < count; i++) {
+ for (int i = 0; i > 0 && i < count; i++) {
if (syncing) {
// If sync broken, reset sync
if ((_in->readBuf[i] > 0.0f) && !KGSSTV_SYNC_WORD[match]) {
This works (i.e. doesn't crash and I see the decoder window). But I have no access to any SSTV data to test with.
PS. this module seems to be a copy & paste of M17; class M17DecoderModule
.
That decoder isn't listed in the modules for a reason. It's an unfinished prototype that has no functionality whatsoever.
Never expect a module not listed as "Working/Beta" (or not listed at all) to work.
Then what is the OPT_BUILD_KG_SSTV_DECODER
option for?
But I did not use CMake to built sdrpp.exe
.
For me to use when I'm working on the prototype. It's off by default.
When playing with the
kg_sstv_decoder
, I hit this crash. From WinDbg:Call stack:
Since the
vmoss
instruction is not reading from a 16-byte aligned address (it isds:002b:5d219ff8
). I built everything with MSVC-2019 and option-arch:AVX
.Seems that
_in->readBuf[i]
must be properly aligned here:But I fail to understand how/where that alignment should be done.