summaryrefslogtreecommitdiffstats
path: root/luni/src
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.i.katkov@intel.com>2014-04-28 16:53:18 +0700
committerNarayan Kamath <narayan@google.com>2014-05-06 16:10:46 +0100
commit6bc20cd8fc6784a75158d8f1db27802a12b28f94 (patch)
tree1424900d40c1854e5681a6ecf8f9c53b55a19508 /luni/src
parent9f2ab8ad1eff63bd5cf5a300feefb1be396161dc (diff)
downloadlibcore-6bc20cd8fc6784a75158d8f1db27802a12b28f94.zip
libcore-6bc20cd8fc6784a75158d8f1db27802a12b28f94.tar.gz
libcore-6bc20cd8fc6784a75158d8f1db27802a12b28f94.tar.bz2
Fix BN to use correct size of array
NativeBN_litEndInts2bn uses len as a size of the generated array while it should be wlen for 64-bit. This will fix the following BigIntegerTest cases: - BigIntegerTest#test_Constructor_ILjava_util_Random - BigIntegerTest#test_hashCode Change-Id: Ife98d11cf94cd5568e55163f98fc4fe3de9d3918 Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com> Reported-by: Marcus Oakland <marcus.oakland@arm.com>
Diffstat (limited to 'luni/src')
-rw-r--r--luni/src/main/native/java_math_NativeBN.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/luni/src/main/native/java_math_NativeBN.cpp b/luni/src/main/native/java_math_NativeBN.cpp
index d0a03b7..be87ea6 100644
--- a/luni/src/main/native/java_math_NativeBN.cpp
+++ b/luni/src/main/native/java_math_NativeBN.cpp
@@ -212,7 +212,7 @@ static void NativeBN_litEndInts2bn(JNIEnv* env, jclass, jintArray arr, int len,
#else
int i = len; do { i--; ret->d[i] = tmpInts[i]; } while (i > 0);
#endif
- ret->top = len;
+ ret->top = wlen;
ret->neg = neg;
// need to call this due to clear byte at top if avoiding
// having the top bit set (-ve number)