This is the Android follow-up of Issue 169327 .
A bit of historical evolution of things:
In Issue 169327 security folks figured out that we should prevent >2GB allocations to prevent memory bugs due to sign vs unsigned / sign extensions bugs.
This is happening today on Win and Linux.
On Windows: this check is done in the shim layer (which siggi@ is migrating to the new unified shim)
On Linux: this check is baked into tcmalloc.cc (See IsAllocSizePermitted in tcmalloc.cc)
Historically on Android we never had a way to hook malloc() calls. Until very recently we didn't have even a way to invoke the new handler when malloc() fails because of OOM.
The latter is being fixed by the work on the unified allocator shim (see Issue 550886) and later follow up in crrev.com/2201363002.
Now that we have a shim, we could afford this check also on Android.
If nobody has objections I'd volunteer for doing this.
From a practical viewpoint, the best place to make this happen is the allocator_shim.cc
This requires a bit of refactoring which overlaps with siggi's work on migrating the windows shim to the unified allocator_shim.cc (otherwise win could end up having the same check twice in the malloc path, which is undesirable).
Once that sticks (https://codereview.chromium.org/2183093002/ did that but got recently reverted) I'll get on this if there are no other objections.
Comment 1 by rsgav...@chromium.org
, Jan 25 2017