commit | 372ad415e6f55a5c78276011a67b68bd8c14aecf | [log] [tgz] |
---|---|---|
author | Steven Moreland <smoreland@google.com> | Tue Aug 04 21:20:36 2020 +0000 |
committer | Android (Google) Code Review <android-gerrit@google.com> | Tue Aug 04 21:20:36 2020 +0000 |
tree | a10fb74555ab81b34073144f4a114087ab57c475 | |
parent | f8788be0545340e09672997a064de8627ade1574 [diff] | |
parent | faf53f3ea16e58ea39ec1bf2670182820bba8b7b [diff] |
Merge "libutils: check vsnprintf error" into oc-dev
diff --git a/libutils/FileMap.cpp b/libutils/FileMap.cpp index 1afa1ec..b9f411e 100644 --- a/libutils/FileMap.cpp +++ b/libutils/FileMap.cpp
@@ -182,6 +182,10 @@ adjust = offset % mPageSize; adjOffset = offset - adjust; adjLength = length + adjust; + if (__builtin_add_overflow(length, adjust, &adjLength)) { + ALOGE("adjusted length overflow: length %zu adjust %d", length, adjust); + return false; + } flags = MAP_SHARED; prot = PROT_READ;