From c3a1836fcd67d0511f8c186afd5ffdfa9f3f699e Mon Sep 17 00:00:00 2001 From: Albert Kharisov Date: Sat, 28 Aug 2021 14:58:01 +0300 Subject: [PATCH] [FL-1746] Fix IRDA freeze (#673) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reading large RAW signal causes freeze Co-authored-by: あく --- lib/irda/encoder_decoder/common/irda_common_decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/irda/encoder_decoder/common/irda_common_decoder.c b/lib/irda/encoder_decoder/common/irda_common_decoder.c index b402ed14..e57844cc 100644 --- a/lib/irda/encoder_decoder/common/irda_common_decoder.c +++ b/lib/irda/encoder_decoder/common/irda_common_decoder.c @@ -257,7 +257,7 @@ void irda_common_decoder_reset_state(IrdaCommonDecoder* common_decoder) { common_decoder->databit_cnt = 0; common_decoder->switch_detect = false; common_decoder->message.protocol = IrdaProtocolUnknown; - if (common_decoder->protocol->timings.preamble_mark == 0) { + if ((common_decoder->protocol->timings.preamble_mark == 0) && (common_decoder->timings_cnt > 0)) { --common_decoder->timings_cnt; shift_left_array(common_decoder->timings, common_decoder->timings_cnt, 1); }