Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e92416df authored by Ashok Bhat's avatar Ashok Bhat
Browse files

Don't assume that size_t is 32-bit



Crypto data was being copied to java jint array in chunks of
size_t. This will not work on LP64 as size_t will be 64-bit.
This patch changes copy to use int32_t chunks instead of size_t.

Change-Id: I75d910a1182ad2f58f432cd172127f048b4c393b
Signed-off-by: default avatarAshok Bhat <ashok.bhat@arm.com>
parent 2383f220
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -556,7 +556,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
        return JNI_FALSE;
    }

    size_t numSubSamples = size / sizeof(size_t);
    size_t numSubSamples = size / sizeof(int32_t);

    if (numSubSamples == 0) {
        return JNI_FALSE;
@@ -566,7 +566,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
    jboolean isCopy;
    jint *dst = env->GetIntArrayElements(numBytesOfEncryptedDataObj, &isCopy);
    for (size_t i = 0; i < numSubSamples; ++i) {
        dst[i] = ((const size_t *)data)[i];
        dst[i] = ((const int32_t *)data)[i];
    }
    env->ReleaseIntArrayElements(numBytesOfEncryptedDataObj, dst, 0);
    dst = NULL;
@@ -583,7 +583,7 @@ static jboolean android_media_MediaExtractor_getSampleCryptoInfo(
        jboolean isCopy;
        jint *dst = env->GetIntArrayElements(numBytesOfPlainDataObj, &isCopy);
        for (size_t i = 0; i < numSubSamples; ++i) {
            dst[i] = ((const size_t *)data)[i];
            dst[i] = ((const int32_t *)data)[i];
        }
        env->ReleaseIntArrayElements(numBytesOfPlainDataObj, dst, 0);
        dst = NULL;