Security fix for CVE-2022-0545 (fix RHBZ#2052012, fix RHBZ#2052013)
Backport 63fdcbb5889e.
Fix T94629: The IMB_flip API would fail with large images
Fix IMB_flip[xy] to handle cases where integer overflow might occur when
given sufficiently large image dimensions.
All of these fixes were of a similar class where the intermediate
sub-expression would overflow silently. Widen the types as necessary.
Differential Revision: https://developer.blender.org/D13744