Closed LafeWessel closed 1 year ago
@LafeWessel Thank you very much for reporting!
I have reproduced the issue using your code and understand its cause. This is due to the same cause as https://github.com/noritada/grib-rs/issues/30. However, since checking the number of bytes and returning the https://github.com/noritada/grib-rs/issues/30 error is done a little later than accessing the bytes, we are getting a different error in the case where the access fails as in this case.
The current code only supports 2 bytes as a number of extra parameters in Section 7. https://github.com/noritada/grib-rs/issues/30 should occur when it is greater than 2 bytes, and as far as I can tell from checking the data, it occurs when the submessage contains 3-bytes parameters. This https://github.com/noritada/grib-rs/pull/32 occurs when it is less than 2 bytes (the data which I reproduced the issue with contains 1-byte parameters).
Fixing https://github.com/noritada/grib-rs/issues/30 should resolve this issue together, so please be patient for a little longer.
No worries, thanks for all the help!
After merging #33, the program in the report will not crash. However, the number of decoded values of 46th submessage (indexed from zero) will be 2, which is much smaller than its size hint:
size hint: (1038240, Some(1038240))
0.0
0.0
So, this issue still remains. In this submessage, 0 is set as the value of some parameter indicating the number of bits, and I am wondering if some special processing is needed in that case.
Simple Description on the Bug
When parsing GRIB data in the 5.3/7.3 format, sometimes there is an out-of-bounds error when calling
.dispatch()
. This may be related to #30, but I am unsure.Steps to Reproduce
Using the same data as #29 (NOAA GFS data), I iterated through the submessages and attempted to parse and print a few values of each, along with the definition information about the messages.
Expected Behavior
Parse GRIB file normally.
Actual Behavior
Here is the backtrace along with the console output about the GRIB layer definitions. The source of the error is at
src/decoders/complex.rs:36:14
.Additional Context
Some of the other layers were unable to be parsed and returned a
DecodeError(ComplexPackingDecodeError(NotSupported))
, but I'm guessing that those errors are related to #30.Here is a link to my Google Drive folder containing the GRIB file that I am currently testing with. link