vlm / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
1.03k stars 553 forks source link

lte-rrc sib3 R9 extension addition error #41

Open oWCTejLVlFyNztcBnOoh opened 10 years ago

oWCTejLVlFyNztcBnOoh commented 10 years ago

It seems the wireshark bug 6199 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6199) is present in asn1c, too.

Here my input data:

00801c31186fe0c43846069ce2d001020054ce772cb5509b985818628c5709d6b481413aa519200000

This is an BCCH-DL-SCH-Message according to 3GPP R11. The ASN.1 is here: https://anonsvn.wireshark.org/wireshark/trunk/asn1/lte-rrc/EUTRA-RRC-Definitions.asn

The web-decoder here (http://www.marben-products.com/asn.1/services/decoder-asn1-lte.html) has no problems with the input.

I did decode the bits manually. The result:

0b100000000001110000110001000110000110111111100000110001000011100001000110000001101001110011100010110100000000000100000010000000000101010011001110011101110010110010110101010100001001101110011000010110000001100001100010100011000101011100001001
110101
10101
1 #PresenceAntennaPort1
01 #neighCellConfig
001 #t-ReselectionEUTRA
0 000001 01 00000100 
1110  #4 bits bitmap (0b1110) prefix to the extension addition
10101 00101  00011 00100  10000 00000000 000000000

The output from asn1c:

NativeInteger T-Reselection got value 1 (NativeInteger.c:263)
Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
  [PER got  1<= 1 bits => span 4 +0[4..4]:c0 (0) => 0x0] (per_support.c:114)
Member intraFreqCellReselectionInfo->t-ReselectionEUTRA-SF is optional, p=0 (4->4) (constr_SEQUENCE.c:1102)
Getting normally small length (per_support.c:199)
  [PER got  1<=63 bits => span 266 +9[2..64]:81 (62) => 0x0] (per_support.c:114)
  [PER got  6<=62 bits => span 272 +9[8..64]:81 (56) => 0x1] (per_support.c:114)
l=2 (per_support.c:204)
Extensions 2 present in SystemInformationBlockType3 (constr_SEQUENCE.c:1145)
  [PER got  2<=56 bits => span 274 +10[2..56]:41 (54) => 0x1] (per_support.c:114)
Read in extensions bitmap for SystemInformationBlockType3 of 2 bits (40..) (constr_SEQUENCE.c:1158)
  [PER got  1<= 2 bits => span 1 +0[1..2]:40 (1) => 0x0] (per_support.c:114)
  [PER got  1<= 1 bits => span 2 +0[2..2]:40 (0) => 0x1] (per_support.c:114)
Decoding member s-IntraSearch-v920 in SystemInformationBlockType3 00000000 (constr_SEQUENCE.c:1186)
Getting open type s-IntraSearch-v920... (per_opentype.c:70)
  [PER got  8<=54 bits => span 282 +10[10..56]:41 (46) => 0x4] (per_support.c:114)
  [PER got 24<=46 bits => span 306 +11[26..48]:3a (22) => 0xea9464] (per_support.c:114)
  [PER got  8<=22 bits => span 314 +14[10..24]:20 (14) => 0x80] (per_support.c:114)
Getting open type s-IntraSearch-v920 encoded in 4 bytes (per_opentype.c:96)
    Decoding s-IntraSearch-v920 as SEQUENCE (UPER) (constr_SEQUENCE.c:1050)
    Decoding member s-IntraSearchP-r9 in s-IntraSearch-v920 (constr_SEQUENCE.c:1120)
    Decoding NativeInteger ReselectionThreshold (UPER) (NativeInteger.c:246)
    Integer with range 5 bits (INTEGER.c:601)
      [PER got  5<=32 bits => span 5 +0[5..32]:ea (27) => 0x1d] (per_support.c:114)
    Got value 29 + low 0 (INTEGER.c:622)
    NativeInteger ReselectionThreshold got value 29 (NativeInteger.c:263)
    Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
    Decoding member s-IntraSearchQ-r9 in s-IntraSearch-v920 (constr_SEQUENCE.c:1120)
    Decoding NativeInteger ReselectionThresholdQ-r9 (UPER) (NativeInteger.c:246)
    Integer with range 5 bits (INTEGER.c:601)
      [PER got  5<=27 bits => span 10 +0[10..32]:ea (22) => 0xa] (per_support.c:114)
    Got value 10 + low 0 (INTEGER.c:622)
    NativeInteger ReselectionThresholdQ-r9 got value 10 (NativeInteger.c:263)
    Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
Too large padding 22 in open type (per_opentype.c:119)
Failed to decode element s-IntraSearch-v920 (per_opentype.c:120)
likayo commented 9 years ago

I am new to asn.1, and I have tried using the same ASN.1 LTE RRC spec. I used the online asn1c compiler (http://lionet.info/asn1c/asn1c.cgi) to compile it. Unfortunating, the compiler encountered an error while parsing the "[[" bracket (left version bracket).