avcodec/pnm: Check magic bytes directly without pnm_get()
Fixes: Timeout (10sec -> 30ms) (case 15089)
Fixes: 15089/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PBM_fuzzer-
5767535057698816
Fixes: 16001/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGM_fuzzer-
5199169645445120
Fixes: 16003/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGMYUV_fuzzer-
5076443270217728
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>