Xudong-Huang / generator-rs

rust stackful generator library
Apache License 2.0
286 stars 35 forks source link

:bug: remove UB #15

Closed Ekleog closed 4 years ago

Ekleog commented 4 years ago

The UB arose due to self.context.para being MaybeUninit::zeroed, which is an invalid value for an *mut dyn T, as fat pointers' vtable pointer cannot be null.

Which means that during the phase on the left-hand side of the =, an invalid object was created, which lead to UB.

This, in turn, manifested in https://github.com/carllerche/loom/issues/50

Thank @nagisa for the help debugging this!

Xudong-Huang commented 4 years ago

Thanks for the fix!