Commit a049c53e authored by Badescu, Ciprian's avatar Badescu, Ciprian Committed by Roberto Rosca

better handling of writeBlockSize greater than samples/slot

fix the case when writeBlockSize is greater than samples/slot
by sending samples from the same buffer instead of out-of-bounds memory read
parent fc26b8c0
...@@ -483,11 +483,23 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action) ...@@ -483,11 +483,23 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action)
} }
} }
int tmp = openair0_write_reorder(&UE->rfdevice, proc->timestamp_tx, txp, rxtxD->writeBlockSize, fp->nb_antennas_tx, flags); openair0_timestamp writeTimestamp = proc->timestamp_tx;
AssertFatal(tmp == rxtxD->writeBlockSize, ""); int writeBlockSize = rxtxD->writeBlockSize;
if ( writeBlockSize > fp->get_samples_per_slot(proc->nr_slot_tx, fp)) {
// if writeBlockSize gets longer that slot size, fill with dummy
const int dummyBlockSize = writeBlockSize - fp->get_samples_per_slot(proc->nr_slot_tx, fp);
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, txp, dummyBlockSize, fp->nb_antennas_tx, flags);
AssertFatal(tmp == dummyBlockSize, "");
writeTimestamp += dummyBlockSize;
writeBlockSize -= dummyBlockSize;
}
int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, txp, writeBlockSize, fp->nb_antennas_tx, flags);
AssertFatal(tmp == writeBlockSize, "");
for (int i = 0; i < fp->nb_antennas_tx; i++) for (int i = 0; i < fp->nb_antennas_tx; i++)
memset(txp[i], 0, rxtxD->writeBlockSize); memset(txp[i], 0, writeBlockSize);
} }
void processSlotTX(void *arg) void processSlotTX(void *arg)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment