Skip to content

Commit 3fcfa1e

Browse files
committed
m2k: signal generator infinite loop bug fix
Signed-off-by: IonutMuthi <ionut.muthi@analog.com>
1 parent 3221134 commit 3fcfa1e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/m2k/src/old/signal_generator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,6 +2272,12 @@ size_t SignalGenerator::get_samples_count(unsigned int chnIdx, double rate, bool
22722272
}
22732273

22742274
out_cleanup:
2275+
2276+
// for size 0 return 0 going further with this value will get stuck in an infinite loop
2277+
if(size == 0) {
2278+
return 0;
2279+
}
2280+
22752281
/* The buffer size must be a multiple of 4 */
22762282
if(ptr->type == SIGNAL_TYPE_BUFFER) {
22772283
size = size + size % 0x04;

0 commit comments

Comments
 (0)