aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
AgeCommit message (Collapse)Author
2018-12-06Prepare releaseErlang/OTP
2018-12-06Handle erroneous length during decode (BER only) without crashingKenneth Lundin
2018-08-02Prepare releaseErlang/OTP
2018-08-02Fix NIF stack recursion bug and enforce a limitRaimo Niskanen
Fix recursion bug when decoding Constructed value within another value - here the allowed buffer for the recursed decode shall only be the size of the enclosing value, not the whole buffer. Return ASN1_ERROR if BER decode recurses more than about 8 kWords.
2018-03-09Update release notesErlang/OTP
2018-03-09Update version numbersErlang/OTP
2018-03-02Dialyzer suppress per_common:to_bitstring/2Raimo Niskanen
2018-01-17asn1_SUITE: Fix failure in xref_export_all/1Björn Gustavsson
The variable 'S' was used twice. If the test case failed because there were unused functions in asn1_SUITE, there would be an ugly badmatch exception instead of the intended nice error message.
2017-12-08Update release notesErlang/OTP
2017-12-08Update version numbersErlang/OTP
2017-11-23Merge branch 'hans/asn1/asn1ct_test_fix/ERL-518/OTP-14787' into maintHans Nilsson
* hans/asn1/asn1ct_test_fix/ERL-518/OTP-14787: asn1: asn1:test now handles no_ok_wrapper and undec_rest
2017-11-21asn1: asn1:test now handles no_ok_wrapper and undec_restHans Nilsson
2017-11-21asn1: Further adjustments on generated codeHans Nilsson
2017-11-21asn1: Protect more by try..catchHans Nilsson
2017-10-10Merge branch 'lars/doc-cleanup/OTP-14475' into maintLars Thorsen
* lars/doc-cleanup/OTP-14475: [edoc] Remove unused module otpsgml_layout.erl Remove unused files from the documentation build
2017-09-28Remove unused files from the documentation buildLars Thorsen
2017-09-22Update release notesErlang/OTP
2017-09-22Update version numbersErlang/OTP
2017-09-12asn1: Fix test suite deprecated functionsLukas Larsson
2017-08-24Merge branch 'maint-20' into maintRaimo Niskanen
* maint-20: Updated OTP version Prepare release Accept non-binary options as socket-options Bump version Fix broken handling of default values in extensions for PER compiler: Fix live regs update on allocate in validator Take fail labels into account when determining liveness in block ops Check for overflow when appending binaries, and error out with system_limit
2017-08-23Prepare releaseErlang/OTP
2017-08-16Bump versionRaimo Niskanen
2017-08-16Fix broken handling of default values in extensions for PERBjörn Gustavsson
Default values have never worked in extension for PER. Note that for default values in the root part of SEQUENCE, giving a value equal to the DEFAULT value, will result in the same encoding as if asn1_DEFAULT was given. However, that behavior is not promised by the documentation. The documentation says that asn1_DEFAULT should be used for default values. For DEFAULT in extensions, only implement what the documentation promises and nothing more. ERIERL-60
2017-07-27Merge branch 'maint-20' into maintJohn Högberg
* maint-20: Updated OTP version Update release notes Update version numbers Fix doc for the 'quiet' option; it defaults to false asn1: Fix missing quotes of external encoding call Add a dedicated close function for TCP ports to prevent issues like ERL-430/448 Close TCP ports properly on send timeout erts: Add missing release note
2017-07-26Update release notesErlang/OTP
2017-07-26Update version numbersErlang/OTP
2017-07-20asn1: Fix missing quotes of external encoding callSverker Eriksson
introduced by 8e4a9864385242b962ce7446f7daa4f58cfecca5.
2017-07-04Corrected behavior of option {n2n, EnumTypeName} whenKenneth Lundin
EnumTypeName contains a hypen like fore example Cause-Misc. This caused syntax errors when compiling the generated Erlang code.
2017-06-21Prepare releaseErlang/OTP
2017-06-14Update copyright yearHans Nilsson
2017-06-13Remove reference to removed module 'asn1rt'Björn Gustavsson
2017-05-31Revert "Prepare release"Hans Nilsson
This reverts commit eaf8ca41dfa4850437ad270d3897399c9358ced0.
2017-05-30Prepare releaseErlang/OTP
2017-05-05Revert "Prepare release"Raimo Niskanen
This reverts commit dc57404252c47520f352834ad9be45ad684f96c9.
2017-05-04Prepare releaseErlang/OTP
2017-05-04Update copyright yearRaimo Niskanen
2017-03-27Add a no_native option wherever there is an on_loadKostis Sagonas
This is a poor man's solution that allows to build and test the system with all files compiled to native code simply by setting the ERL_COMPILER_OPTS environment variable. Better solutions, like automatically setting the no_native option whenever the compiler sees an on_load attribute, obviously exist but require more time to implement.
2017-03-15Remove default clauses that cause exceptions for internal errorsBjörn Gustavsson
Just crash if there is an internal error.
2017-03-14Clean up commentsBjörn Gustavsson
* Remove out-commented code * Fix obvious typos and bad grammar * Adhere to the conventions for when to use "%" and "%%".
2017-03-14Clean up asn1ct_gen:emit/1Björn Gustavsson
Remove blank lines between clauses; use matching instead of is_list/1 guards.
2017-03-14Remove unused clauses in asn1ct_gen:emit/1Björn Gustavsson
2017-03-14Clean up use of asn1ct_gen:emit/1Björn Gustavsson
Stop up using asn1ct_gen:emit/1 with a tuple instead of a list. Also remove the remaining uses of asn1ct_gen:demit/1.
2017-03-14Remove the 'debug' optionBjörn Gustavsson
The debug option no longer serves any useful purpose.
2017-03-14Only generate needed single quotes around function namesBjörn Gustavsson
That will make code slightly easier to read.
2017-03-14asn1ct_gen_ber_bin_v2: Remove unused codeBjörn Gustavsson
The code is not covered. The code is also not present in the PER backend. Here is a somewhat more formal proof that the code cannot be reached: asn1ct_gen_ber_bin_v2:gen_encode_user/3 calls asn1ct_gen:gen_encode_constructed/4 where Typename is a list of one element. asn1ct_gen:gen_encode_constructed/4 will call asn1ct_gen_ber_bin_v2:gen_encode/3 via asn1ct_gen:gen_types/4. Note that if InnerType in asn1ct_gen:gen_encode_constructed/4 is 'SEQUENCE OF' or 'SET OF', Typename will be extended to a list with two elements. If InnerType in asn1ct_gen:gen_encode_constructed/4 is 'SET', 'SEQUENCE', or 'CHOICE', then asn1ct_gen_ber_bin_v2:gen_encode/3 will be called with the last argument being a #'ComponentType'{}. asn1ct_gen_ber_bin_v2:gen_encode/3 will in that cause extend Typename before calling itself recursively. Therefore, Typename is always a list with at least two elements when the removed code is called.
2017-03-14asn1ct_gen_per: Fix broken dialyzer suppression functionBjörn Gustavsson
ce431409d0daba broke generation of dialyzer suppressions for per and uper. While we are it, add type tests to asn1ct_func:is_used/1 to avoid similar problems in the future.
2017-03-14asn1_erl_nif.c: Correct handling of tags >= 16384Björn Gustavsson
Tags number above 16383 were not decoded correctly in ber_decode_tag(). We could fix the problem, but there does not seem to be any need. First, the only way that high tag numbers can be created is with manual tagging; after 1994 manual tagging is no longer recommended. Second, the ASN.1 playground (http://asn1-playground.oss.com) only supports tags up to 16383 (the same is presumably true for OSS Nokalva's other tools). Therefore, clean up the existing code and make it an explicit 'invalid_tag' error when tags above 13383 are encountered (instead of an implicit 'wrong_tag' error).
2017-03-01Fix typos: lenght -> lengthMyron Marston
2017-02-21encode/decode: Include the stack trace in error returnsBjörn Gustavsson
The generated encode/2 and decode/2 functions can return cryptic error messages. Consider this ASN.1 spec: T DEFINITIONS AUTOMATIC TAGS ::= BEGIN S ::= SEQUENCE { b BOOLEAN, i INTEGER (1..100), j INTEGER (0..7), s OCTET STRING } END In OTP 19, the error terms will look like this: Eshell V8.2 (abort with ^G) 1> asn1ct:compile('T', [ber]). ok 2> rr('T'). ['S'] 3> 'T':encode('S', #'S'{}). {error,{asn1,{encode_boolean,undefined}}} 4> 'T':encode('S', #'S'{b=false}). {error,{asn1,{encode_integer,undefined}}} 5> 'T':encode('S', #'S'{b=false,i=7,j=0}). {error,{asn1,function_clause}} Some error terms are clearer than other. In the first error term, it is clear that the error refers to the 'b' field, since there is only one BOOLEAN in 'S'. The second error term could refer to either 'i' or 'j'. The last error term... well... in this case we can infer that it must refer to 's'. The easiest way to provide more information is to include the stack trace with line numbers in the error term: 3> 'T':encode('S', #'S'{b=false}). {error,{asn1,{{encode_integer,undefined}, [{'T',encode_integer,2,[{file,"T.erl"},{line,240}]}, {'T',enc_S,2,[{file,"T.erl"},{line,102}]}, {'T',encode,2,[{file,"T.erl"},{line,36}]}, {erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,674}]}, {shell,exprs,7,[{file,"shell.erl"},{line,686}]}, {shell,eval_exprs,7,[{file,"shell.erl"},{line,641}]}, {shell,eval_loop,3,[{file,"shell.erl"},{line,626}]}]}}} By looking at the generated Erlang code, we can see that encoding failed for 'i'. This is an compatible change. All that the documentation says is that the format of the error tuple is: {error,{asn1,Description}} With this change, Description is always a tuple: {ErrorDescription,StackTrace} Alternatives considered: Providing more information in the error term itself and make sure there can be no 'function_clause', 'badarg', or 'badmatch' exceptions. That would be possible, but it would require a lot of work and it would increase the size of the generated code and make it slower. Therefore, this solution was rejected.
2017-02-21PER decoding: Be less verbose for invalid ENUMERATEDBjörn Gustavsson
When an invalid value is encountered when trying to decode an ENUMERATED, the exception can be quite verbose. Here is an actual example from NBAP-PDU-Contents: _ -> exit({error,{asn1,{decode_enumerated,{V4@V3,[chCode1div1,chCode2div1,chCode2div2,chCode4div1,chCode4div2,chCode4div3,chCode4div4,chCode8div1,chCode8div2,chCode8div3,chCode8div4,chCode8div5,chCode8div6,chCode8div7,chCode8div8,chCode16div1,chCode16div2,chCode16div3,chCode16div4,chCode16div5,chCode16div6,chCode16div7,chCode16div8,chCode16div9,chCode16div10,chCode16div11,chCode16div12,chCode16div13,chCode16div14,chCode16div15,chCode16div16]}}}}) Listing the possible values for an ENUMERATED when decoding fails is not helpful and increases the code size (it would have made somewhat more sense to list the possible values if *encoding* failed).