aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test
AgeCommit message (Collapse)Author
2018-12-04Handle erroneous length during decode (BER only) without crashingKenneth Lundin
2018-08-03Merge branch 'maint-20' into maintRaimo Niskanen
* maint-20: Updated OTP version Prepare release Fix NIF stack recursion bug and enforce a limit Conflicts: OTP_VERSION lib/asn1/doc/src/notes.xml lib/asn1/vsn.mk otp_versions.table
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-06-18Update copyright yearHenrik Nord
2018-04-16asn1: Eliminate use of erlang:get_stacktrace/0Björn Gustavsson
Also eliminate use of erlang:get_stacktrace/0 in code generated by the ASN.1 compiler.
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-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-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-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-05-04Update copyright yearRaimo Niskanen
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-17PER: Slightly improve error reporting for encodingBjörn Gustavsson
Generate slightly better error reasons when encoding of INTEGER, ENUMERATED, or BOOLEAN fails.
2017-02-13Merge branch 'bjorn/cuddle-with-tests'Björn Gustavsson
* bjorn/cuddle-with-tests: ets_tough_SUITE: Add the gen_server behavior ets_tough_SUITE: Remove functions that are never called ets_SUITE: Eliminate internal exports used for spawn/apply lists_SUITE: Run the droplast/1 test case random_{iolist,unicode_list}: Remove unused functions stdlib test: Eliminate export_all from re_SUITE and friends asn1_SUITE: Make sure that there are no unused functions Simplify running of asn1 app tests asn1_SUITE: Remove unused functions
2017-02-10asn1_SUITE: Make sure that there are no unused functionsBjörn Gustavsson
Add xref_export_all/1 to make sure that all functions in the asn1_SUITE module are actually called (directly or indirectly).
2017-02-10Simplify running of asn1 app testsBjörn Gustavsson
Instead of initiating running of the app tests for asn1 from asn1_SUITE, put the tests in asn1_app_SUITE and let it take care of itself. While we are it, eliminate 'export_all' in the new module and use lists:keyfind/3 instead of lists:keysearch/3.
2017-02-10asn1_SUITE: Remove unused functionsBjörn Gustavsson
In 8a39672af4d9, the testX420/1 test case is no longer run. Remove the unused functions.
2017-02-06Teach the ASN.1 compiler the 'maps' optionBjörn Gustavsson
When the 'maps' option is given, the SEQUENCE and SET types are represented as maps instead of as records. Optional and default values must be not be given as asn1_NOVALUE or asn1_DEFAULT in a map passed to the M:encode/2 function; they must be omitted from the map. Similarly, when decoding missing values will be omitted from the map. No .hrl files will be generated when the 'maps' options is used. That means values in an ASN.1 module must be retrieved by calling the appropriate function in generated module. Since we one day hope to get rid of the options 'compact_bit_string', 'legacy_bit_string', and 'legacy_erlang_types', we will not allow them to be combined with the 'maps' option.
2017-02-03Add additional tests of Extension Addition GroupsBjörn Gustavsson
2017-02-03Refactor h323test.erl to simplify debuggingBjörn Gustavsson
2017-02-03testMultipleLevels: Use asn1_test_lib:roundtrip()Björn Gustavsson
2017-02-03Correct spelling of NBAP-PDU-DescriptionsBjörn Gustavsson
2017-01-13asn1: Remove deprecated functionsBjörn Gustavsson
Remove the entire asn1rt module. All functions in it were deprecated in OTP 17. In asn1ct, remove the deprecated functions asn1ct:encode/3 and asn1ct:decode/3. Also remove asn1ct:encode/2, which has not been formally deprecated but is undocumented.
2016-11-29asn1 test suite: Suppress warnings for -compile(export_all)Björn Gustavsson
2016-08-12asn1_test_lib: Compile ASN.1 modules in parallelBjörn Gustavsson
Test that the changes in the previous commit allows us to compile ASN.1 modules in parallel.
2016-04-13Merge branch 'henrik/update-copyrightyear'Henrik Nord
* henrik/update-copyrightyear: update copyright-year
2016-03-23asn1_SUITE: Remove temporary filesBjörn Gustavsson
Some test machines have quite small hard drives. Help them by remove temporary files in end_per_test_case/2.
2016-03-18Eliminate suite and doc clausesBjörn Gustavsson
2016-03-18Replace ?config() macro with proplists:get_value()Björn Gustavsson
2016-03-18Modernize timetrapsBjörn Gustavsson
2016-03-18Eliminate ?line macrosBjörn Gustavsson
2016-03-15update copyright-yearHenrik Nord
2016-03-07Merge branch 'maint'Björn Gustavsson
* maint: asn1_SUITE_value: Don't test the LDAP module
2016-03-03asn1_SUITE_value: Don't test the LDAP moduleBjörn Gustavsson
asn1ct:test(Mod) will generate sample values for data types in an ASN.1 modules. The following definition from LDAP can cause problems for asn1ct:test/1: Filter ::= CHOICE { and [0] SET SIZE (1..MAX) OF filter Filter, or [1] SET SIZE (1..MAX) OF filter Filter, not [2] Filter, equalityMatch [3] AttributeValueAssertion, substrings [4] SubstringFilter, greaterOrEqual [5] AttributeValueAssertion, lessOrEqual [6] AttributeValueAssertion, present [7] AttributeDescription, approxMatch [8] AttributeValueAssertion, extensibleMatch [9] MatchingRuleAssertion, ... } If we were unlucky (which we were on some computers), the construction of sample values would not terminate. Eliminate the problem for now by not testing the LDAP module. This workaround should be removed when we have added some limitation to the recursion in asn1ct_value when generating values.
2016-02-17Remove out-commented references to the test_server applicationsBjörn Gustavsson
Cleanliness.
2016-02-17Eliminate use of test_server.hrl and test_server_line.hrlBjörn Gustavsson
As a first step to removing the test_server application as as its own separate application, change the inclusion of test_server.hrl to an inclusion of ct.hrl and remove the inclusion of test_server_line.hrl.
2016-02-15Merge branch 'maint'Björn Gustavsson
* maint: asn1: Suppress warnings for improper lists in generated code
2016-02-12asn1: Suppress warnings for improper lists in generated codeBjörn Gustavsson
2016-01-22Merge branch 'maint'Björn Gustavsson
* maint: PER: Correct compilation of named INTEGERs
2016-01-21PER: Correct compilation of named INTEGERsBjörn Gustavsson
When a constrained INTEGER has more than 16536 values and named values, the compiler would crash when compiling to the PER format. Example: Longitude ::= INTEGER { oneMicrodegreeEast(10), oneMicrodegreeWest(-10), unavailable(1800000001) } (-1799999999..1800000001) Reported-by: Ingars
2015-12-11Use 'rand' instead of the obsolete 'random' moduleBjörn Gustavsson
In most cases, we don't have to seed the random number generator, as the rand:uniform/1 takes care about that itself.
2015-11-30BER: Fix encoding of empty named BIT STRINGBjörn Gustavsson
Encoding an empty named BIT STRING would fail for BER. Noticed-by: Svilen Ivanov
2015-06-18Change license text to APLv2Bruce Yinhe
2015-03-20Merge branch 'rickard/time_api/OTP-11997'Rickard Green
* rickard/time_api/OTP-11997: (22 commits) Update primary bootstrap inets: Suppress deprecated warning on erlang:now/0 inets: Cleanup of multiple copies of functions Add inets_lib with common functions used by multiple modules inets: Update comments Suppress deprecated warning on erlang:now/0 Use new time API and be back-compatible in inets Remove unused functions and removed redundant test asn1 test SUITE: Eliminate use of now/0 Disable deprecated warning on erlang:now/0 in diameter_lib Use new time API and be back-compatible in ssh Replace all calls to now/0 in CT with new time API functions test_server: Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API Replace usage of erlang:now() with usage of new API otp_SUITE: Warn for calls to erlang:now/0 Replace usage of erlang:now() with usage of new API Multiple timer wheels Erlang based BIF timer implementation for scalability Implement ethread events with timeout ... Conflicts: bootstrap/bin/start.boot bootstrap/bin/start_clean.boot bootstrap/lib/compiler/ebin/beam_asm.beam bootstrap/lib/compiler/ebin/compile.beam bootstrap/lib/kernel/ebin/auth.beam bootstrap/lib/kernel/ebin/dist_util.beam bootstrap/lib/kernel/ebin/global.beam bootstrap/lib/kernel/ebin/hipe_unified_loader.beam bootstrap/lib/kernel/ebin/inet_db.beam bootstrap/lib/kernel/ebin/inet_dns.beam bootstrap/lib/kernel/ebin/inet_res.beam bootstrap/lib/kernel/ebin/os.beam bootstrap/lib/kernel/ebin/pg2.beam bootstrap/lib/stdlib/ebin/dets.beam bootstrap/lib/stdlib/ebin/dets_utils.beam bootstrap/lib/stdlib/ebin/erl_tar.beam bootstrap/lib/stdlib/ebin/escript.beam bootstrap/lib/stdlib/ebin/file_sorter.beam bootstrap/lib/stdlib/ebin/otp_internal.beam bootstrap/lib/stdlib/ebin/qlc.beam bootstrap/lib/stdlib/ebin/random.beam bootstrap/lib/stdlib/ebin/supervisor.beam bootstrap/lib/stdlib/ebin/timer.beam erts/aclocal.m4 erts/emulator/beam/bif.c erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_db_hash.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_thr_progress.c erts/emulator/beam/utils.c erts/emulator/sys/unix/sys.c erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/ebin/init.beam erts/preloaded/src/erts_internal.erl lib/common_test/test/ct_hooks_SUITE_data/cth/tests/empty_cth.erl lib/diameter/src/base/diameter_lib.erl lib/kernel/src/os.erl lib/ssh/test/ssh_basic_SUITE.erl system/doc/efficiency_guide/advanced.xml
2015-03-20asn1 test SUITE: Eliminate use of now/0Björn Gustavsson
2015-03-12Merge branch 'maint'Björn Gustavsson
* maint: asn1ct_gen: Correct generation of .hrl files for multiple ellipses Fix BER code generation