Commit Graph

2328 Commits

Author SHA1 Message Date
Lev Walkin 62155df04d add stack overflow protection for SEQUENCE and SEQUENCE OF 2017-10-21 01:16:17 -07:00
Lev Walkin 3c37385d29 fix OER comparison API 2017-10-21 01:09:13 -07:00
Lev Walkin 836686167d fix after UPER round-trip fuzz 2017-10-21 00:24:31 -07:00
Lev Walkin 5de8274266 fix UPER BIT STRING trailer encoding 2017-10-20 23:12:09 -07:00
Lev Walkin ba2c5727d0 more debug 2017-10-20 23:09:45 -07:00
Lev Walkin 1418d985cb verify unusual PER canonical order 2017-10-20 17:27:29 -07:00
Bi-Ruei, Chiu bc6ef1f98a Add two tests in tests-asn1c-compiler directory 2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu e460c3b7a3 Fix error during 'make check' 2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 156b0feb5c Fix duplication of selector functions
There will be two selector functions generated for the following ASN.1 excerpt.

InitiatingMessage ::= SEQUENCE {
    procedureCode S1AP-ELEMENTARY-PROCEDURE.&procedureCode     ({S1AP-ELEMENTARY-PROCEDURES}),
    criticality   S1AP-ELEMENTARY-PROCEDURE.&criticality       ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}),
    value         S1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode})
}

This pull request enables different function names by adding field name after type name.
2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu dcc822a090 Fix duplicate type names generated in headers file
For example, there are many 'enum value_PR' and 'struct value' generated if
a class is instantiated as many instances.

typedef enum value_PR {
    value_PR_NOTHING,    /* No components present */
    .....
} value_PR;

typedef struct ProtocolIE_Field_6563P5 {
    ....
    struct value {
        value_PR present;
        union value_u {
        } choice;

        /* Context for parsing across buffer boundaries */
        asn_struct_ctx_t _asn_ctx;
    } value;

    /* Context for parsing across buffer boundaries */
    asn_struct_ctx_t _asn_ctx;
} ProtocolIE_Field_6563P5_t;
2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 3e2de6960b Solve the problem that information object table with one entry can not be properly handled
E-RABToBeSetupItemBearerSUReqIEs S1AP-PROTOCOL-IES ::= {
    { ID id-E-RABToBeSetupItemBearerSUReq   CRITICALITY reject	TYPE E-RABToBeSetupItemBearerSUReq	PRESENCE mandatory },
    ...
}

result in 'FATAL: Information Object Set E-RABToBeSetupItemBearerSUReqIEs contains no objects at line xxxx'

If it contains more than one entry then there is no problem.

E-RABSetupRequestIEs S1AP-PROTOCOL-IES ::= {
    { ID id-MME-UE-S1AP-ID                  CRITICALITY reject  TYPE MME-UE-S1AP-ID                     PRESENCE mandatory }|
    { ID id-eNB-UE-S1AP-ID                  CRITICALITY reject  TYPE ENB-UE-S1AP-ID                     PRESENCE mandatory }|
    { ID id-uEaggregateMaximumBitrate       CRITICALITY reject  TYPE UEAggregateMaximumBitrate          PRESENCE optional  }|
    { ID id-E-RABToBeSetupListBearerSUReq   CRITICALITY reject  TYPE E-RABToBeSetupListBearerSUReq      PRESENCE mandatory },
    ...
}
2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 214c491951 Pass evaluated arguments to members and type references
One of the most tricky ASN.1 excerpt :

E-RABDataForwardingItemIEs S1AP-PROTOCOL-IES ::= {
    { ID id-E-RABDataForwardingItem   CRITICALITY ignore   TYPE E-RABDataForwardingItem PRESENCE mandatory },
    ...
}

E-RABSubjecttoDataForwardingList ::= E-RAB-IE-ContainerList { {E-RABDataForwardingItemIEs} }

E-RAB-IE-ContainerList { S1AP-PROTOCOL-IES : IEsSetParam } ::=
    ProtocolIE-ContainerList { 1, maxnoofE-RABs, {IEsSetParam} }

ProtocolIE-ContainerList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES : IEsSetParam} ::=
    SEQUENCE (SIZE (lowerBound..upperBound)) OF
    ProtocolIE-SingleContainer {{IEsSetParam}}

ProtocolIE-SingleContainer {S1AP-PROTOCOL-IES : IEsSetParam} ::=
    ProtocolIE-Field {{IEsSetParam}}

ProtocolIE-Field {S1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE {
    id          S1AP-PROTOCOL-IES.&id           ({IEsSetParam}),
    criticality S1AP-PROTOCOL-IES.&criticality  ({IEsSetParam}{@id}),
    value       S1AP-PROTOCOL-IES.&Value        ({IEsSetParam}{@id})
}
2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 89cde74d4a Supply meaningful data for last %d argument of DEBUG() 2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu b6bd8d788b Use parenthesis to avoid ambiguity of operator precedence 2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 742a196624 Fix 'FATAL: Does not look like criticality is a CLASS field reference (xxxx) denoting a type one line xxx' 2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 069c07657e Fix crash during dealing with empty optinal fields of ioc cell 2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu aeff717baf Fix unrecognized value type for reject/ignore
In Module_1,

	Criticality ::= ENUMERATED { reject, ignore, notify }

In Module_2,

	IMPORTS
		Criticality
	FROM Module_1

		someMessage SOME-CLASS ::= {
			CRITICALITY	ignore
		}

This pull request add the capability to resolve 'reject', 'ignore' and 'notify'
in Module_2.
2017-10-20 17:15:57 -07:00
Bi-Ruei, Chiu 50934ba3d4 Fix 'Information Object Set XXX contains no objects' when parsing S1AP's ASN.1
The aforementioned error message displayed during processing the following ASN.1 excerpt.

S1AP-ELEMENTARY-PROCEDURES S1AP-ELEMENTARY-PROCEDURE ::= {
    S1AP-ELEMENTARY-PROCEDURES-CLASS-1 |
    S1AP-ELEMENTARY-PROCEDURES-CLASS-2,
    ...
}

S1AP-ELEMENTARY-PROCEDURES-CLASS-1 S1AP-ELEMENTARY-PROCEDURE ::= {
    handoverPreparation                |
...
    writeReplaceWarning,
    ...,
    uERadioCapabilityMatch             |
....
    uEContextResume
}

S1AP-ELEMENTARY-PROCEDURES-CLASS-2 S1AP-ELEMENTARY-PROCEDURE ::= {
    handoverNotification               |
...
    privateMessage,
    ...,
    downlinkUEAssociatedLPPaTransport  |
...
    mMECPRelocationIndication
}

Because S1AP-ELEMENTARY-PROCEDURES-CLASS-1 and S1AP-ELEMENTARY-PROCEDURES-CLASS-2
are resolved 'after' S1AP-ELEMENTARY-PROCEDURES, so the ioc tables of them are not
available during resolving S1AP-ELEMENTARY-PROCEDURES. So we can not drop the
latter's containedSubtype field at first pass of asn1f_resolve_constraints of fix
process.

We also add second pass of asn1f_resolve_constraints to have a chance to combine
ioc tables of S1AP-ELEMENTARY-PROCEDURES-CLASS-1 and
S1AP-ELEMENTARY-PROCEDURES-CLASS-2.
2017-10-20 17:15:57 -07:00
Lev Walkin 4e5edcf063 temporarily mask unfinished tests 2017-10-20 04:28:20 -07:00
Lev Walkin 6bc5696f52 fix consrtaint propagation for random_fill 2017-10-20 04:19:37 -07:00
Lev Walkin d14802fa0f fix OER SEQUENCE decode memory leak 2017-10-20 03:51:21 -07:00
Lev Walkin 9d328eec0a use oer guara 2017-10-20 03:51:21 -07:00
Lev Walkin 42f6c88018 fix OER NULL and SEQUENCE extensions round-trip 2017-10-20 03:22:51 -07:00
Lev Walkin a460cbd13e verify ASN.1 syntax prior to a lengthy run through a bundle 2017-10-20 02:18:04 -07:00
Lev Walkin 130cffe9a9 add options to readme 2017-10-19 04:18:12 -07:00
Lev Walkin 312e3e0f96 remove gcc compiler warnings 2017-10-19 03:49:50 -07:00
Lev Walkin 1d2a6e8b3f allow fully default flags for distcheck 2017-10-19 03:45:21 -07:00
Lev Walkin 435469ec33 remove gcc compiler warnings 2017-10-19 03:39:32 -07:00
Lev Walkin c547661e3c no default 32-bit test on travis, no 32-bit libasan there 2017-10-19 03:36:09 -07:00
Lev Walkin b1f4f33ae6 remove gcc-7 compiler warnings 2017-10-19 03:28:49 -07:00
Lev Walkin 0afbd325f3 detect leak detector in runtime 2017-10-19 03:21:21 -07:00
Lev Walkin 48e82d1f1f removed gcc-7 warnings 2017-10-19 03:07:27 -07:00
Lev Walkin b2d896e4d9 verify that undefined sanitizer can be linked in 2017-10-19 09:50:20 +00:00
Lev Walkin bc09dd4845 generate constraints differently to avoid warnings 2017-10-19 02:16:35 -07:00
Lev Walkin 4bd9eaf7e1 force use variable 2017-10-19 01:16:42 -07:00
Lev Walkin 0a3bf61d0d do not --enable-test-32bit by default 2017-10-19 00:34:47 -07:00
Lev Walkin 1fef87a46f linkability check for ASAN and UBSAN 2017-10-19 00:25:18 -07:00
Lev Walkin 03531df897 stronger detection of fuzzing infrastructure (linkability) 2017-10-19 00:25:18 -07:00
Vasil Velichkov d346ffd810 Initialize _asn_ctx in the tests 2017-10-18 23:32:47 -07:00
Vasil Velichkov 72b104470e Fix several sign-compare errors in the tests 2017-10-18 23:32:47 -07:00
Vasil Velichkov 97656bdd11 Initialize ret in safe_printf(...)
../../libasn1print/asn1print.c:59:5: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
2017-10-18 23:32:47 -07:00
Vasil Velichkov c8bc573f06 Fix another sign-compare error in oer_support.c
oer_support.c:66:24: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
2017-10-18 23:32:47 -07:00
Vasil Velichkov 3d3af67a37 Run check and distcheck in separate travis builds 2017-10-18 23:32:47 -07:00
Vasil Velichkov 51612b2361 Do not tail the distcheck output
From Travis logs:
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
2017-10-18 23:32:47 -07:00
Vasil Velichkov 3875d507d9 Switch uint8_t to size_t as len_len's type 2017-10-18 23:32:47 -07:00
Vasil Velichkov e56f4b24d4 Fix one sign-compare error in OCTET_STRING.c
OCTET_STRING.c:1896:46: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
2017-10-18 23:32:47 -07:00
Vasil Velichkov e60e6f225a Fix sign-compare error in oer_support
oer_support.c:38:22: error: comparison between signed and unsigned integer expressions [-Werror=s
2017-10-18 23:32:47 -07:00
Vasil Velichkov c3e0019b56 Fix sign-compare error in constr_SEQUENCE.c
constr_SEQUENCE.c:1438:24: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
2017-10-18 23:32:47 -07:00
Vasil Velichkov 39ab82f36d Fix two strict-aliasing errors
NativeReal.c:366:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
NativeReal.c:370:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
2017-10-18 23:32:47 -07:00
Vasil Velichkov 6aac1c3c16 Fix sign-compare errors
BIT_STRING.c:494:45: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
BIT_STRING.c:580:46: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
2017-10-18 23:32:47 -07:00