Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: libadblockplus-android/jni/JniJsValue.cpp

Issue 29437563: Issue 5239 - JsValue access crash (Closed)
Patch Set: Created May 12, 2017, 11:55 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libadblockplus-android/jni/JniJsValue.cpp
diff --git a/libadblockplus-android/jni/JniJsValue.cpp b/libadblockplus-android/jni/JniJsValue.cpp
index d39645fe400cc06a51ca55a4725f54599ab2fb05..92c4847c6d20e656a1fe140ca439ef1140a26cbe 100644
--- a/libadblockplus-android/jni/JniJsValue.cpp
+++ b/libadblockplus-android/jni/JniJsValue.cpp
@@ -168,7 +168,8 @@ static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
jobject NewJniJsValue(JNIEnv* env, AdblockPlus::JsValue&& jsValue, jclass jsValueClassArg)
{
sergei 2017/05/12 15:38:07 I thought about adding some static_assert like bel
- return env->NewObject(jsValueClass->Get(), jsValueCtor, new AdblockPlus::JsValue(std::move(jsValue)));
+ auto pJsValue = reinterpret_cast<uintptr_t>(new AdblockPlus::JsValue(std::move(jsValue)));
+ return env->NewObject(jsValueClass->Get(), jsValueCtor, static_cast<jlong>(pJsValue));
}
AdblockPlus::JsValue* JniGetJsValuePtr(jlong ptr)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld