Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion custom_components/myhome/gateway_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def _is_status_report_item(item: Any) -> bool:
)


_WHO4_QUERY_RE = re.compile(r"^\*#4\*(?P<where>[^#*]+(?:#[^*]+)*)(?:\*(?P<dim>\d+))?##$")
_WHO4_QUERY_RE = re.compile(r"^\*#4\*(?P<where>[^#*]+(?:#[^#*]+)*)(?:\*(?P<dim>\d+))?##$")
_WHO4_REPLY_RE = re.compile(
r"^\*(?:#4\*(?P<dim_where>[^*]+)\*.*|4\*[^*]+\*(?P<act_where>[^*]+))##$"
)
Expand Down
9 changes: 9 additions & 0 deletions tests/test_issue_886_myhomeserver1_41_zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,15 @@ async def test_pause_status_edge_cases_and_mixed_non_who4_collected_frames(
_mismatched_who4_reply_zones("*#4*60##", ["*1*1*11##", "*#4*34*0*0146##"])
== {"34"}
)
# Multi-segment WHERE (`#4#01`) and linear-time rejection of malformed `#`-repeated input (CodeQL py/redos)
assert (
_mismatched_who4_reply_zones("*#4*60#4#01*60##", ["*#4*34#4#01*60*55##"])
== {"34"}
)
assert (
_mismatched_who4_reply_zones("*#4*1" + "#a" * 40 + "!", ["*#4*34*0*0146##"])
is None
)

scheduler = FrameScheduler()
try:
Expand Down
Loading