copyimage: check requested slice early when cube maps are involved
The generalized check for the z-slice happens in 'check_region_bounds',
but this function requires the image pointer that is acquired in
prepare_target_err
, therefore replace the assertion with a proper test.
CC: mesa-stable
The problem was found by fuzzing virglrenderer, which resulted in a call
glCopyImageSubData(3, GL_TEXTURE_CUBE_MAP, 0, 34, 36, 8, 2, GL_TEXTURE_2D, 0, 0, 0, 0, 31, 29, 1)
that lead to a crash with mesa compiled in release mode, and the assertion failure when compiled in debug mode.