avidec: Make sure a packet is large enough before reading its data