Using ocf.NewDecoder(r) on a random avro file, the Decode operation panics due to a null pointer exception from hamba/avro. The issue is that newEfaceDecoder inside codec_dynamic does not check the error of genericReceiver and proceeds with a nil typ value, which causes a null pointer exception later in the code.
One fix could be to add a Null condition in genericReceiver in codec_generic.go:
case Null:
return reflect2.TypeOf((*null)(nil)), nil
That at least results in a "avro: schema type null in unsupported" error rather than a NPE. Ideally errors should also not be ignored, and turned into some sort of error upward.
Using
ocf.NewDecoder(r)
on a random avro file, the Decode operation panics due to a null pointer exception from hamba/avro. The issue is thatnewEfaceDecoder
inside codec_dynamic does not check the error ofgenericReceiver
and proceeds with a niltyp
value, which causes a null pointer exception later in the code.One fix could be to add a
Null
condition ingenericReceiver
in codec_generic.go:That at least results in a "avro: schema type null in unsupported" error rather than a NPE. Ideally errors should also not be ignored, and turned into some sort of error upward.