diff options
author | Lukas Larsson <[email protected]> | 2011-07-12 11:18:13 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2011-08-01 16:38:50 +0200 |
commit | b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5 (patch) | |
tree | 6f358d15fb6d4f5d2eb2ae730ebbee5d6c66261c /lib/asn1/c_src/asn1_erl_nif.c | |
parent | 0b0e143a6c832128e6347fd142282f549b01add6 (diff) | |
download | otp-b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5.tar.gz otp-b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5.tar.bz2 otp-b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5.zip |
Update asn1 nif to handle calls with an empty binary
Diffstat (limited to 'lib/asn1/c_src/asn1_erl_nif.c')
-rw-r--r-- | lib/asn1/c_src/asn1_erl_nif.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c index 7ce461ad5c..a9bf98c44a 100644 --- a/lib/asn1/c_src/asn1_erl_nif.c +++ b/lib/asn1/c_src/asn1_erl_nif.c @@ -1015,6 +1015,9 @@ static ERL_NIF_TERM encode_per_complete(ErlNifEnv* env, int argc, if (!enif_alloc_binary(in_binary.size, &out_binary)) return enif_make_atom(env, "alloc_binary_failed"); + if (in_binary.size == 0) + return enif_make_binary(env, &out_binary); + if ((complete_len = complete(&out_binary, in_binary.data, in_binary.size)) <= ASN1_ERROR) { enif_release_binary(&out_binary); |