GBytes: add range-checked pointer getter
Submitted by Allison (desrt)
Link to original bug (#756906)
Description
Add a helper to GBytes to perform the common task of:
-
multiplying an element size times an array length, with bounds checks
-
adding it to an offset, with bounds checks
-
ensuring the resulting end offset is in range of the GBytes
-
returning a pointer to the start of the range
This is built on the new efficient checked integer arithmetic macros introduced in bug 756903.
Also add a testcase.