apedec: check for input buffer overflow while reading frame header