Fix crash caused by out-of-bounds memory accesses when drawing background and/or blending. This fix is conceptually identical to the approach as the commit of 8ff5079e5eef37b9bd5b212350f0cefbd9546b1b Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1229>