Closed crane-may closed 6 months ago
Thanks for the report! This should be fixed in https://github.com/capnproto/capnproto-rust/pull/499.
Note that for a field that does not show up in the schema, has_named()
will return an error FieldNotFound
rather than false
. This matches the upstream behavior in capnproto-c++:
https://github.com/capnproto/capnproto/blob/5d83271d808467af8f4dbaa4c73daaf53a90b5ec/c%2B%2B/src/capnp/dynamic.c%2B%2B#L1004-L1006
https://github.com/capnproto/capnproto/blob/5d83271d808467af8f4dbaa4c73daaf53a90b5ec/c%2B%2B/src/capnp/schema.c%2B%2B#L507-L513
When I use the has_named interface
some_struct.has_named("some_field_name")
, sometimes it's panic.Then I check the code: https://github.com/capnproto/capnproto-rust/blob/master/capnp/src/schema.rs
I'm guessing that
mid
might be equal toupper
, which would cause the array to go out of bounds. I don't know if my findings are correct.