Fix int overflow in shift

Thankfully this is not actually a security vulnerability, because
the sign bit just gets set, and the conversion to long performs
sign extension. Still, it would break when adding one with 32.

To avoid repeats of this same mistake, convert the creation of
masks to using a function in a way that makes it impossible.

Test: new test for this in NetworkCapabilitiesUtilsTest
Change-Id: Iadbbca6b09b02d98e45a43984f7749e1a795ce02
2 files changed
tree: f78478d145e723ab5162992f7a1c084fdd6335ab
  1. staticlibs/