nilsmagnus / grib

Golang GRIB2 parser
Other
57 stars 19 forks source link

Crash while reading file #17

Open landru29 opened 5 years ago

landru29 commented 5 years ago

http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl?bottomlat=-90&dir=%2Fgfs.2019020512&file=gfs.t12z.pgrb2.1p00.f003&leftlon=0&lev_10_m_above_ground=on&rightlon=360&toplat=90&var_UGRD=on&var_VGRD=on

panic: runtime error: makeslice: len out of range

goroutine 1 [running]: github.com/nilsmagnus/grib/griblib.ReadMessage(0x177be20, 0xc420336060, 0x0, 0x17e6fc8, 0x0) github.com/nilsmagnus/grib/griblib/sections.go:80 +0xb4 github.com/nilsmagnus/grib/griblib.ReadMessages(0x177be20, 0xc420336060, 0xc42004f520, 0x55ec6e, 0x7fa8dea7a160, 0xc420382060, 0xc42004f520) github.com/nilsmagnus/grib/griblib/sections.go:58 +0x9b

landru29 commented 5 years ago

Oups! Noaa switched to https ! the data I recieved is not grib file. But the read should not panic, just through an error

nilsmagnus commented 5 years ago

Hmm, how can I reproduce this situation?

wwek commented 5 years ago
head -n 8 gfs.t06z.pgrb2.0p50.f000 > 1.txt |cat -

--593d9cc39dbbd1cf Content-type: text/plain; charset=UTF-8 Content-range: bytes 66461079-66628632/90829745

GRIB��� H�P�i����]J�0�]J�m��� � "Q�1�PE��

like this?

Oups! Noaa switched to https ! the data I recieved is not grib file. But the read should not panic, just through an error

measuredweighed commented 4 years ago

We ran into this issue. I've created a pull request with a fix that appears to be working well for us.