-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UB when interacting with Stream::Null(_) #2802
base: master
Are you sure you want to change the base?
Conversation
…tr_as_cell! These two functions are pretty unsafe, but having these assertions makes it easier to catch UB in testing.
Heads up: Remember to |
I would expect a null stream to act like reading/writing to |
f2a4ef8
to
c31e369
Compare
c31e369
to
7108e87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that adding a test for at_end_of_steam/1
is also a good idea.
…nding tests for null streams Also fixed at_end_of_stream/0 leaving a choicepoint.
The following test triggers UB on master, while using public-facing APIs:
This PR fixes #2801, by:
atom!("null_stream")
, which is mapped toStream::Null(Default::default())
inMachine::configure_streams()
.stream_as_cell!
macro into animpl From<Stream> for HeapCellValue
.I left in the sanity checks used while debugging the issue, in case someone inadvertently creates another null Cons in the future.