Skip to content

Commit 20c8b2f

Browse files
authored
fix(foundation): reject a registrar code from the wrong enum (#2224) (#2245)
Problem: _check_code only required some enum member. The registry enums compare equal to their values, so a member of another enum was stored and could replace a shipped entry, e.g. register_linktype(TransType.ICMP, ...) overwrote Frame.__proto__[LinkType.ETHERNET]. Fix: _check_code takes the enum the registrar is typed on and checks the type, not equality. register_tcp, register_udp, register_sctp and register_apptype call it too, with number=True, so a plain int is still accepted but an IntEnum member of another enum is not. Test: test_registrar_code_check_unit gains a wrong-enum case for every registrar, each equal by value to one of its own members where possible, asserting RegistryError with every registry snapshotted and unchanged.
1 parent 733749b commit 20c8b2f

2 files changed

Lines changed: 216 additions & 66 deletions

File tree

0 commit comments

Comments
 (0)