avcodec/diracdec: Move buf[] read after size check