Commit Graph

16 Commits

Author SHA1 Message Date
Sebastian Thiel 463db85110 Don't allow Stacks to be allocated with a null-ptr
The latter must be seen as undefined behaviour, as it will cause
the `sk_num` function to return -1 to indicate the error, which
causes all kinds of issues.

Thus there now is a panic to abort the program if stacks are initialized
with a null-ptr, and special handling of that case when decoding
a Pkcs file.
2017-03-07 07:39:25 +01:00
Sebastian Thiel ec2685347c Fix for empty stacks
The culprit is that `sk_num(stack)` can return -1
as c_int if there is no stack allocated.

Previously, thanks to unsafe casts, this would result in
a isize::max() for len() and iteration size if there was no stack.

Now this case is handled specifically, which fixes the issue.
2017-03-06 10:14:39 +01:00
Steven Fackler f2c69ae7e9 Merge remote-tracking branch 'origin/master' into x509-builder 2017-02-11 10:13:00 -08:00
Steven Fackler 12ae31ad47 Switch to foreign_types 2017-02-03 23:03:35 -08:00
Steven Fackler 18c5d1f771 Add init calls to new constructors 2016-11-07 20:50:57 +00:00
Steven Fackler 597d05b8f8 Add stack creation and push 2016-11-06 23:46:42 -08:00
Steven Fackler ed69d6b037 Add Stack::pop 2016-11-05 13:40:53 -07:00
Steven Fackler 52feaae59f More cleanup 2016-11-05 13:15:14 -07:00
Steven Fackler ac36d542fd Simplify destructor a bit 2016-11-05 13:10:50 -07:00
Steven Fackler 398ab2fbc4 Add a consuming iterator for Stacks 2016-11-05 13:01:54 -07:00
Steven Fackler f15c817c2d Rustfmt 2016-11-05 10:54:17 -07:00
Steven Fackler 01ae978db0 Get rid of Ref
There's unfortunately a rustdoc bug that causes all methods implemented
for any Ref<T> to be inlined in the deref methods section :(
2016-11-04 17:16:59 -07:00
Steven Fackler d5a9a239f6 More minor cleanup 2016-11-01 19:36:08 -07:00
Steven Fackler c776534ad4 Clean up stack 2016-11-01 19:25:40 -07:00
Steven Fackler 79c51d5e51 Clean up stack destructor 2016-11-01 19:12:38 -07:00
Lionel Flandrin 3bdefa987a Implement a generic Stack API to deal with OpenSSL stacks 2016-11-01 21:23:13 +01:00