summaryrefslogtreecommitdiffstats
path: root/vm/compiler/Utility.c
diff options
context:
space:
mode:
authorBen Cheng <bccheng@android.com>2010-11-23 11:55:16 -0800
committerBen Cheng <bccheng@android.com>2010-11-23 11:55:16 -0800
commitabf3ef8206de388c7fc5f529f3ee05419475b651 (patch)
treebc1f83a5c7721e8a050f73939be9e32ee0658279 /vm/compiler/Utility.c
parent72ef412b56becfbdd54f239ea672a48b163ff1d2 (diff)
downloadandroid_dalvik-abf3ef8206de388c7fc5f529f3ee05419475b651.tar.gz
android_dalvik-abf3ef8206de388c7fc5f529f3ee05419475b651.tar.bz2
android_dalvik-abf3ef8206de388c7fc5f529f3ee05419475b651.zip
Fix off-by-1 bug in expandable bit vectors.
Bug: 3224068 Change-Id: I6e5e956da380262e65cb1da9bcc51ba31f5b0d14
Diffstat (limited to 'vm/compiler/Utility.c')
-rw-r--r--vm/compiler/Utility.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/vm/compiler/Utility.c b/vm/compiler/Utility.c
index 711d4cf3f..daeb8937c 100644
--- a/vm/compiler/Utility.c
+++ b/vm/compiler/Utility.c
@@ -277,7 +277,8 @@ bool dvmCompilerSetBit(BitVector *pBits, int num)
if (!pBits->expandable)
return false;
- int newSize = (num + 31) >> 5;
+ /* Round up to word boundaries for "num+1" bits */
+ int newSize = (num + 1 + 31) >> 5;
assert(newSize > pBits->storageSize);
u4 *newStorage = dvmCompilerNew(newSize * sizeof(u4), false);
memcpy(newStorage, pBits->storage, pBits->storageSize * sizeof(u4));