"""Validation of malformed wire data through the trimmed C++ core.""" import struct from pathlib import Path import capnp import pytest @pytest.mark.parametrize("pointer", [3, 7, 0xFFFFFFFF00000003]) def test_capability_and_reserved_pointers_rejected(pointer): schema = capnp.load(str(Path(__file__).with_name("addressbook.capnp"))) # Single segment: AddressBook root (zero data words, one pointer) followed # by a capability/reserved pointer where the people list should be. data = struct.pack(" (); }") with pytest.raises(capnp.KjException, match="Interfaces are not supported"): capnp.load(str(schema))