avcodec/gdv: Check input palette size before rescale()