[FL-1746] Fix IRDA freeze (#673)

Reading large RAW signal causes freeze

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Albert Kharisov 2021-08-28 14:58:01 +03:00 committed by GitHub
parent 1b6a942f4a
commit c3a1836fcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}