Merge pull request #371 from ryandrake08/rtltcp-input

Fix divide-by-zero and buffer overruns in getFrameSync()
This commit is contained in:
lwvmobile
2026-10-19 16:25:31 -04:00
committed by GitHub
2 changed files with 6 additions and 3 deletions

View File

@@ -165,7 +165,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
char synctest8[9]; //M17
char modulation[8];
char *synctest_p;
char synctest_buf[10240]; //what actually is assigned to this, can't find its use anywhere?
char synctest_buf[10240 + 48]; //history for sync matching; look-back window up to 48 bytes
int lmin, lmax, lidx;
//assign t_max value based on decoding type expected (all non-auto decodes first)
@@ -214,7 +214,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
synctest20[20] = 0;
modulation[7] = 0; //not initialized or terminated (unsure if this would be an issue or not)
synctest_pos = 0;
synctest_p = synctest_buf + 10;
synctest_p = synctest_buf + 48;
sync = 0;
lmin = 0;
lmax = 0;
@@ -1388,7 +1388,7 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
{
// buffer reset
synctest_pos = 0;
synctest_p = synctest_buf;
synctest_p = synctest_buf + 48;
noCarrier (opts, state);
}

View File

@@ -454,6 +454,9 @@ void dc_block_filter(struct demod_state *fm)
{
int i, avg;
int64_t sum = 0;
if (fm->result_len == 0) {
return;
}
for (i=0; i < fm->result_len; i++) {
sum += fm->result[i];
}