You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[allow(clippy::derive_partial_eq_without_eq)]#[derive(Clone,PartialEq,::prost::Message)]pubstructFoo{#[prost(message, required, boxed, tag = "1")]pubx:::prost::alloc::boxed::Box<Foo>,}
If I use the Foo type to decode an empty byte slice, I get an stack overflow error:
use prost::Message;include!(concat!(env!("OUT_DIR"), "/foo.rs"));fnmain(){let _ = Foo::decode("".as_bytes());}
I guess the behavior is caused by prost attempting to construct a Foo object, which is not possible, since constructing it recursively depends on constructing a new object of the same type.
The text was updated successfully, but these errors were encountered:
I don't know how to solve this besides throwing an error during prost-build. Is this a real-world example, or did you find out about this during experimentation?
Suppose I have a proto file with a recursive message:
prost-build
will generate this struct:If I use the
Foo
type to decode an empty byte slice, I get an stack overflow error:I guess the behavior is caused by
prost
attempting to construct aFoo
object, which is not possible, since constructing it recursively depends on constructing a new object of the same type.The text was updated successfully, but these errors were encountered: