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
s2n_stuffer and s2n_blob have confusingly non-normalized fields.
s2n_stuffer defines growable and allocd fields. s2n_blob also defines growable and allocated fields.
The semantics of this are very confusing. What would it mean for an allocated stuffer to have a non-allocated blob? Isn't "allocated-ness" purely a property of the blob?
Solution:
After some investigation with #4943, my understanding is as follows.
s2n_blob should remove the growable field. This is extensively documented in the above PR, but essentially, any blob that is alloced is growable. If it isn't alloced, it isn't growable.
s2n_stuffer should remove the allocd field. I was playing around with some unit tests, and I was able to make this change with breaking any unit tests. But trying to remove growable from the stuffer broke lots of things, which makes sense.
stuffer "growable" semantics are used to deliberately fail writes that are too large. This is a valuable behavior that we want to keep. (but this logic should be documented in the code 🙂)
Requirements / Acceptance Criteria:
remove growable from s2n_blob.
remove alloced from s2n_stuffer.
And preferably add some comments about why the fields exist and what they accomplish.
The text was updated successfully, but these errors were encountered:
After some further research, this goal will be a little complicated
remove growable from s2n_blob.
I think at a minimum the field should be renamed to be something more accurate, but currently it's necessary to track whether a 0 sized blob is allocated or a reference.
I can not think of a valid case where we have a zero sized allocation? So I would prefer to just explicitly make that a part of the s2n_blob contract, but that will require some further investigation.
Problem:
s2n_stuffer and s2n_blob have confusingly non-normalized fields.
s2n_stuffer
definesgrowable
andallocd
fields.s2n_blob
also definesgrowable
andallocated
fields.The semantics of this are very confusing. What would it mean for an allocated stuffer to have a non-allocated blob? Isn't "allocated-ness" purely a property of the blob?
Solution:
After some investigation with #4943, my understanding is as follows.
growable
field. This is extensively documented in the above PR, but essentially, any blob that is alloced is growable. If it isn't alloced, it isn't growable.allocd
field. I was playing around with some unit tests, and I was able to make this change with breaking any unit tests. But trying to removegrowable
from the stuffer broke lots of things, which makes sense.stuffer "growable" semantics are used to deliberately fail writes that are too large. This is a valuable behavior that we want to keep. (but this logic should be documented in the code 🙂)
Requirements / Acceptance Criteria:
growable
froms2n_blob
.alloced
froms2n_stuffer
.And preferably add some comments about why the fields exist and what they accomplish.
The text was updated successfully, but these errors were encountered: