avcodec/cbs: Fix potential overflow