Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.9.28 make check fail for MHEG5 sample #92

Open
brchiu opened this issue May 16, 2016 · 3 comments
Open

0.9.28 make check fail for MHEG5 sample #92

brchiu opened this issue May 16, 2016 · 3 comments

Comments

@brchiu
Copy link
Contributor

brchiu commented May 16, 2016

On Lubuntu 64bit environment, executing 'make check' under directory of MHEG5 sample,
I got the following error information.

Recoding sample-InterchangedObject-1.xer into DER and back (1)...
sample-InterchangedObject-1.xer: Decode failed past byte 120: Input processing error
Makefile:506: recipe for target 'check-xer' failed
make: *** [check-xer] Error 2

Below is some GDB debug information, which shows the failure occurred when function OCTET_STRING__convert_hexadecimal trying to decode ExternalReference element.

(gdb) r -b 8192 -ixer -oder sample-InterchangedObject-1.xer
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /media/brchiu/Data/DocCollect/SoftwareTech/asn1c/asn1c-0.9.28/examples/sample.source.MHEG5/mheg5dump -b 8192 -ixer -oder sample-InterchangedObject-1.xer

Breakpoint 2, OCTET_STRING__convert_hexadecimal (sptr=0x668270, chunk_buf=0x6652b8,
chunk_size=4, have_more=1) at OCTET_STRING.c:784
784 OCTET_STRING_t st = (OCTET_STRING_t *)sptr;
(gdb) n
785 const char *chunk_stop = (const char *)chunk_buf;
(gdb) n
786 const char *p = chunk_stop;
(gdb) n
787 const char *pend = p + chunk_size;
(gdb) n
788 unsigned int clv = 0;
(gdb) n
789 int half = 0; /
Half bit _/
(gdb) n
793 ssize_t _ns = st->size + (chunk_size + 1) / 2;
(gdb) n
794 void *nptr = REALLOC(st->buf, ns + 1);
(gdb) n
795 if(!nptr) return -1;
(gdb) n
796 st->buf = (uint8_t *)nptr;
(gdb) n
797 buf = st->buf + st->size;
(gdb) n
804 for(; p < pend; p++) {
(gdb) n
805 int ch = *(const unsigned char *)p;
(gdb) n
806 switch(ch) {
(gdb) n
824 *buf = 0; /
JIC */
(gdb) n
825 return -1;
(gdb) p/x ch
$14 = 0x73
(gdb) bt

0 OCTET_STRING__convert_hexadecimal (sptr=0x668270, chunk_buf=0x6652b8, chunk_size=4,

have_more=1) at OCTET_STRING.c:825

1 0x000000000042d426 in xer_decode_general (opt_codec_ctx=0x7fffffffdc20, ctx=0x668280,

struct_key=0x668270, xml_tag=0x441c26 "group-identifier", buf_ptr=0x6652b8, size=4085, 
opt_unexpected_tag_decoder=0x0, 
body_receiver=0x425e18 <OCTET_STRING__convert_hexadecimal>) at xer_decoder.c:255

2 0x0000000000426aa8 in OCTET_STRING__decode_xer (opt_codec_ctx=0x7fffffffdc20,

td=0x664720 <asn_DEF_OCTET_STRING>, sptr=0x7fffffffd808, 
opt_mname=0x441c26 "group-identifier", buf_ptr=0x6652a6, size=4103, 
opt_unexpected_tag_decoder=0x0, 
body_receiver=0x425e18 <OCTET_STRING__convert_hexadecimal>) at OCTET_STRING.c:1148

3 0x0000000000426b2b in OCTET_STRING_decode_xer_hex (opt_codec_ctx=0x7fffffffdc20,

td=0x664720 <asn_DEF_OCTET_STRING>, sptr=0x7fffffffd808, 
opt_mname=0x441c26 "group-identifier", buf_ptr=0x6652a6, size=4103)
at OCTET_STRING.c:1166

4 0x0000000000419bbc in SEQUENCE_decode_xer (opt_codec_ctx=0x7fffffffdc20,

td=0x663a40 <asn_DEF_ExternalReference>, struct_ptr=0x7fffffffd918, 
opt_mname=0x441b24 "external-reference", buf_ptr=0x6652a6, size=4103)
at constr_SEQUENCE.c:677

5 0x00000000004160ce in CHOICE_decode_xer (opt_codec_ctx=0x7fffffffdc20,

td=0x650280 <asn_DEF_RootClass>, struct_ptr=0x7fffffffda20, 
opt_mname=0x4342e0 "rootClass", buf_ptr=0x665281, size=4140) at constr_CHOICE.c:616

6 0x000000000041f115 in SET_decode_xer (opt_codec_ctx=0x7fffffffdc20,

td=0x651e00 <asn_DEF_SceneClass>, struct_ptr=0x7fffffffdb28, opt_mname=0x433444 "scene", 
buf_ptr=0x665269, size=4164) at constr_SET.c:661

7 0x00000000004160ce in CHOICE_decode_xer (opt_codec_ctx=0x7fffffffdc20,

td=0x6501e0 <asn_DEF_InterchangedObject>, struct_ptr=0x7fffffffdc88, opt_mname=0x0, 
buf_ptr=0x665259, size=4180) at constr_CHOICE.c:616

8 0x000000000042cec6 in xer_decode (opt_codec_ctx=0x7fffffffdc20,

td=0x6501e0 <asn_DEF_InterchangedObject>, struct_ptr=0x7fffffffdc88, buffer=0x665240, 
size=4205) at xer_decoder.c:37

---Type to continue, or q to quit---

9 0x0000000000432b3c in data_decode_from_file (

pduType=0x6501e0 <asn_DEF_InterchangedObject>, file=0x665010, 
name=0x7fffffffe2f8 "sample-InterchangedObject-1.xer", suggested_bufsize=8192, 
on_first_pdu=1) at converter-sample.c:635

10 0x00000000004318a4 in main (ac=1, av=0x7fffffffdf30) at converter-sample.c:263

(gdb) p asn_DEF_ExternalReference
$15 = {name = 0x441cb0 "ExternalReference", xml_tag = 0x441cb0 "ExternalReference",
free_struct = 0x41ac6f <SEQUENCE_free>, print_struct = 0x41a9dd <SEQUENCE_print>,
check_constraints = 0x41ad8e <SEQUENCE_constraint>,
ber_decoder = 0x417f1c <SEQUENCE_decode_ber>,
der_encoder = 0x41946a <SEQUENCE_encode_der>,
xer_decoder = 0x4199ab <SEQUENCE_decode_xer>,
xer_encoder = 0x41a476 <SEQUENCE_encode_xer>, uper_decoder = 0x0, uper_encoder = 0x0,
outmost_tag = 0x0, tags = 0x441c48 <asn_DEF_ExternalReference_tags_1>, tags_count = 1,
all_tags = 0x441c48 <asn_DEF_ExternalReference_tags_1>, all_tags_count = 1,
per_constraints = 0x0, elements = 0x6639c0 <asn_MBR_ExternalReference_1>,
elements_count = 2, specifics = 0x441c80 <asn_SPC_ExternalReference_specs_1>}

@brchiu
Copy link
Contributor Author

brchiu commented Mar 29, 2017

In 2017-03-26 release, make check still failed with the following message :

Recoding sample-InterchangedObject-1.xer into DER and back (1)...
sample-InterchangedObject-1.xer: Decode failed past byte 120: Input processing error
Makefile:506: recipe for target 'check-xer' failed
make: *** [check-xer] Error 2

@brchiu
Copy link
Contributor Author

brchiu commented Apr 11, 2017

After check stack trace, this failure occurs when reading character 's' of 'smth' of the <group-identifier>...</group-identifier> tag because OCTET_STRING__convert_hexadecimal verdict 's' is not an valid hex-decimal character. However, since OCTET_STRING.c has OCTET_STRING_decode_xer_hex as its xer_decoder field of asn_DEF_OCTET_STRING. This 'failed' verdict is inevitable unless we change it to other XER decoding function for OCTECT_STRING.

Perhaps someone who is more familiar with X.693 can advice how to solve it.

Excerpt of sample-InterchangedObject-1.xer :

<InterchangedObject>
    <scene>
        <rootClass>
            <external-reference>
                <group-identifier>smth</group-identifier>  <-- failed when reading 's' of 'smth'
                <object-number>0</object-number>
            </external-reference>
        </rootClass>

</InterchangedObject>

@velichkov
Copy link
Contributor

Hi @brchiu,

The oss tool also fails to decode sample-InterchangedObject-1.xer with similar error about group-identifier so I guess the sample-InterchangedObject-1.xer was generated with older version and is not correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants