aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-07-12 11:18:13 +0200
committerLukas Larsson <[email protected]>2011-08-01 16:38:50 +0200
commitb4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5 (patch)
tree6f358d15fb6d4f5d2eb2ae730ebbee5d6c66261c
parent0b0e143a6c832128e6347fd142282f549b01add6 (diff)
downloadotp-b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5.tar.gz
otp-b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5.tar.bz2
otp-b4cc7b889e61cfb2ec42d83ccd030acc7a77c8a5.zip
Update asn1 nif to handle calls with an empty binary
-rw-r--r--lib/asn1/c_src/asn1_erl_nif.c3
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);