ECCC-MSC / libecbufr

libecbufr is a general purpose, template-oriented BUFR encoding/decoding library
Other
10 stars 7 forks source link

messages encoded with section 2 content are unreadable #41

Open vsouvan opened 4 years ago

vsouvan commented 4 years ago

If you actually encode a message containing Section 2 data, the result is unreadable (to both LibECBUFR and MetManager and maybe others).

Will commit a test case.


Imported from Launchpad using lp2gh.

vsouvan commented 4 years ago

(by chris-beauregard) Running test_section2 under a debugger suggests the read is looking for section 5 about 4 bytes short of the actual location, which suggests section 2 is too short.

vsouvan commented 4 years ago

(by chris-beauregard) Debug output for the test_section2 is giving me:

Warning: length of Section 4 is 8, should have been -6

which is interesting, because there's exactly 14 bytes in my (padded) section 2 including data and header. Somehow section 2 isn't being included in a message length count somewhere.

vsouvan commented 4 years ago

(by chris-beauregard) Turning this over to you, vanh, to check my work. I don't entirely like the fix.

vsouvan commented 4 years ago

(by chris-beauregard) In addition, the section2 header_len was being initialized to 5 instead of 4.