avcodec/mlz: Check offset before writing