fix: adjust anchor search range in compliance config decoder for improved data handling

This commit is contained in:
Brian Harrison
2026-04-02 17:22:56 -04:00
parent 3b04d4683b
commit 0f5aa7a3fc

View File

@@ -738,7 +738,7 @@ def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
# sample_rate: uint16_BE at anchor - 2 # sample_rate: uint16_BE at anchor - 2
# record_time: float32_BE at anchor + 10 # record_time: float32_BE at anchor + 10
_ANCHOR = b'\x01\x2c\x00\x00\xbe\x80\x00\x00\x00\x00' _ANCHOR = b'\x01\x2c\x00\x00\xbe\x80\x00\x00\x00\x00'
_anchor = data.find(_ANCHOR, 40, 100) _anchor = data.find(_ANCHOR, 0, 150)
if _anchor >= 2 and _anchor + 14 <= len(data): if _anchor >= 2 and _anchor + 14 <= len(data):
try: try:
config.sample_rate = struct.unpack_from(">H", data, _anchor - 2)[0] config.sample_rate = struct.unpack_from(">H", data, _anchor - 2)[0]