From 2241a32c9a94bec37aa123ff72273fcd4bb147b8 Mon Sep 17 00:00:00 2001 From: Florian Agbuya Date: Fri, 2 Aug 2024 14:26:53 +0800 Subject: [PATCH] afws_client: report error on JSON data length mismatch --- artiq/frontend/afws_client.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/artiq/frontend/afws_client.py b/artiq/frontend/afws_client.py index fbbbca1a9..50c3de832 100755 --- a/artiq/frontend/afws_client.py +++ b/artiq/frontend/afws_client.py @@ -165,6 +165,8 @@ class Client: return reply[0], None length = int(reply[1]) json_bytes = await self.reader.read(length) + if length != len(json_bytes): + raise ValueError(f"Received data length ({len(json_bytes)}) doesn't match expected length ({length})") return "OK", json_bytes