Age | Commit message (Collapse) | Author |
|
|
|
|
|
* maint:
PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensions
testConstraints: Improve tests of semi-constrained INTEGERs
Test ENUMERATED with many extended values
PER, UPER: Fix record name mismatch between HRL file and decoding code
UPER: Correct encoding of ENUMERATED with more than 63 extended values
Add asn1_test_lib:hex_to_bin/1
|
|
* bjorn/asn1/not-small-bugs/OTP-11153:
PER/UPER: Correct decoding of SEQUENCEs with more than 64 extensions
testConstraints: Improve tests of semi-constrained INTEGERs
Test ENUMERATED with many extended values
UPER: Correct encoding of ENUMERATED with more than 63 extended values
Add asn1_test_lib:hex_to_bin/1
|
|
|
|
Make sure that semi-constrained integers are correctly encoded
in the mininum number of bytes. (The roundtrip test does not
catch problems with non-minimal encodings.) Also test huge
values that must be encoded in 128 or 256 bytes.
|
|
|
|
When a SEQUENCE was defined inline inside extension addition group
like this:
InlinedSeq ::= SEQUENCE {
...,
[[
s SEQUENCE {
a INTEGER,
b BOOLEAN
}
]]
}
the decoding code would return the contents of the SEQUENCE in a
record named 'InlinedSeq_ExtAddGroup1_s', while the record definition
in the generated HRL file would be 'InlinedSeq_s'.
Since there is no reason to use the longer record name (no risk for
ambiguity), correct the name in the decoding code.
|
|
|
|
|
|
* maint: (128 commits)
beam_lib: Correct wrong type specification
testSeqOf: Test constrained, extensible sizes
[snmp/agent] Some restructuring of test suite
Clean up testSeqOf
Extend tests cases for BIT STRING
Improve tests of ENUMERATED
asn1ct_check: Eliminate useless Per argument from complist_as_tuple()
asn1ct_check: Don't pass on #'ObjectClassFieldType'{} with fixed type
asn1ct_gen_per: Remove useless renewal of 'enumval'
Fix encoding of semi-constrained, extensible INTEGERs
PER/UPER: Fix decoding of semi-constrained INTEGERs
testPrim: Simplify test cases using a roundtrip function
BER: Fix handling of a constructed default value for a class
PER: Generate code for deep table constraints at compile-time
Normalize data representation for table constraints
asn1ct: Simplify check_value/2
Extend tests to cover more code in asn1ct_check
Clean up checking of values for ENUMERATEDs
Introduce a new mechanism for structured error handling
asn1_db: Make dbput/3 and dbsave/2 asynchronous
...
|
|
|
|
|
|
|
|
|
|
The Per argument is no longer used; it is only passed around.
|
|
Simplify the backends by letting asn1ct_check replacing a
with the actual type.
|
|
Since fbcb7fe589edbfe79d10d7fe01be8a9f77926b89, the 'enumval'
variable is no longer used.
|
|
Given:
Semi ::= INTEGER (Lb..MAX, ...)
where Lb is an arbitrary integer, attempting to encode an
integer less than Lb would cause the encoder to enter an
infinite loop.
|
|
A semi-constrained INTEGER with a non-zero lower bound would be
incorrectly decoded. This bug was introduced in R16.
|
|
While at it, also test more integer values.
|
|
|
|
For the PER backends, generate code for accessing deep table
constraints at compile-time in the same way as is done for BER.
While at it, remove the complicated indentation code.
Also modernize the test suite and add a test for a deeper nested
constraint.
|
|
The name of the referenced object set name in #simpletableattributes{}
would when used by INSTANCE OF be an atom, but in all other cases
be a {Module,ObjectSetName} tuple. Simplify the code by always using
the latter format.
|
|
Most types don't have any validation functions that does anything
useful, so it is sufficient to call normalize_value/4 for them.
|
|
|
|
Unify the code for checking an enumeration value named in a
DEFAULT and in an ENUMERATED value. There is no need to handle
those cases differently. That also will also make sure that
the following works:
E ::= ENUMERATED { x, ..., y }
e E ::= x
(Extensible ENUMERATEDs were not handled when defining values.)
Always generate an error when an unknown enumeration value is
given (used in a DEFAULT, a message would be printed, but the
compilation would succeed). Also make sure that we always include
the line number for the incorrect enumeration.
Write a new test case and remove the extremely rudimentary
value_bad_enum_test/1 test case.
|
|
|
|
Those functions have no reason to be synchronous since they don't
have a useful return value.
|
|
Also replace unused code with assertions.
While at it, also let reply/2 return 'ok' to silence Dialyzer
warnings for unmatched returns.
|
|
|
|
|
|
|
|
Capture the common pattern of checking a list of named ASN.1
items in a check_fold/3 function.
Clean up checkt/3 using it, replacing the old-style catch
with a try..catch.
|
|
As a preparation for future clean up of the error handling, we
will need to take control on how how asn1ct runs the different
compiler passes.
|
|
An ENUMERATED is always represented as a two-tuple, never as
three-tuple.
|
|
asn1ct_constructed_per:gen_encode_prim_wrapper() no longer serves
any useful purpose, as it is easier to call
asn1ct_per:gen_encode_prim() directly. Also, the DoTag argument
for asn1ct_per:gen_encode_prim() is never actually used, so it can
be eliminated at the same time.
|
|
The list of files to remove was obtained by running "ls -lut"
after running the test cases and comparing the atime for each
file with the start of the test run.
|
|
|
|
asn1ct_check does not pass #pobjectdef{} records on to the backends
(all the original #pobjectdef{} records have been instantiated and
changed to #objectdef{} records).
|
|
Dialyzer issued two new warnings when the 'catch' was removed in
the previous commit.
|
|
The last clause in asn1ct_gen:type/1 does a catched call to type2/1.
If the type2/1 fails {notype,X} is returned.
Since the body of type2/1 essentially is:
case lists:member(X, [...]) of
true ->
{primitive,bif};
false ->
case lists:member(X, [...]) of
true ->
{constructed,bif};
false ->
{undefined,user}
end
end
there is no way that type2/1 can fail. Therefore, we can eliminate
the catch and put the body of type2/1 into the last clause of
type/1. We can also eliminate the code in the callers of type/1
that match {notype,X}.
|
|
|
|
|
|
Stop export functions that are not called from outside their
module. If the functions are not used at all, remove the functions
too.
The unused exports were found by running:
xref:start(s).
xref:add_application(s, code:lib_dir(asn1)).
io:format("~p\n", [xref:analyze(s, exports_not_used)]).
|
|
ObjectDescriptor, UTCTime, and GeneralizedTime are not special and
can be handled in the same way as all other restricted string types.
|
|
This slight optimization will also eliminate some Dialyzer warnings.
|
|
This change brings down the execution time on my computer for the
entire asn1 test suite from about 340 seconds to 310 seconds.
|
|
asn1ct_gen:emit/1 used to make one call to io:put_chars/2 for each
part of the term passed emit/1. By collecting all output into one
iolist for each call emit/1 the time for running the entire asn1
test suite is reduced from about 460 seconds to 340 seconds on my
computer.
|
|
In the 64-bit run-time, there is about 40Mb in old code after
running the asn1 test suite. Since it is very easy to reclaim
that memory, let's do it. Also get rid of the unnecessary call
to code:soft_purge/1 just before loading the new code.
|