esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
291 stars 34 forks source link

Bug in SML-Parser #4213

Open flobehner opened 1 year ago

flobehner commented 1 year ago

The problem

Having an long List in the SML-Message with extended length the last list item is not processed.

Which version of ESPHome has the issue?

current dev branch

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

No response

What platform are you using?

ESP32

Board

No response

Component causing the issue

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

In sml_parser.cpp lines 28 and following:

if (has_extended_length) {
    length = (length << 4) + (this->buffer_[this->pos_ + 1] & 0x0f);
    parse_length = length - 1;
    this->pos_ += 1;
  }

The length is decremented here which is correct for value type data as the TL-Field is here included in the length but incorrect in case of a complex type like a list. According to SML binary encoding specifications the TL-Field directly encodes the number of items in the list.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

flobehner commented 4 months ago

Is there anything i should provide to help fix the issue?