Replace instead of add pointer offsets when out of bounds
Adding large values can overflow the already out-of-bounds offsets to
become negative. Negative offsets are not detected as out-of-bounds, so
it would result in an out-of-bounds access. This can also happen when
they were already large negative values and remain negative after
the addition. Or, when they're small negative values, they can become
in bounds and thus not trigger the desired out-of-bounds behavior.
Just replace the offsets with the out-of-bounds values.
Bug: b/155862459
Change-Id: I38a45832bfea3a13a66f133ee7c2162855f02c61
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/45091
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Alexis Hétu <sugoi@google.com>
Showing
Please
register
or
sign in
to comment