Context
receive_message (sync path) is missing the OP_COMPRESSED minimum-length guard that exists in the async PyMongoProtocol.process_header.
PyMongoProtocol.process_header has the correct guard:
if op_code == 2012:
if length <= 25:
raise ProtocolError(
f"Message length ({length!r}) not longer than standard OP_COMPRESSED message header size (25)"
)
Definition of done
Add the same guard to receive_message before entering the op_code == 2012 branch:
if op_code == 2012:
if length <= 25:
raise ProtocolError(
f"Message length ({length!r}) not longer than standard OP_COMPRESSED message header size (25)"
)
...
Pitfalls
NA