mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix memory corruption issue in SurfaceHandler
Summary: SurfaceHandlerBinding uses string from JVM memory when initializing, which is released before it is used. If JVM manages to collect this memory before instance init, it can lead to use-after-free. Changelog: [Internal] - fix memory corruption in cxx binding of surface handler Reviewed By: mdvacca Differential Revision: D31794515 fbshipit-source-id: 3944ebd065f42a516f036096d07c0126a43c912f
This commit is contained in:
1 parent
928519e4bd
commit
d9689b90a4
1 file changed
+3
-1
@@ -58,11 +58,13 @@ SurfaceHandlerBinding::initHybrid(
|
||||
jint surfaceId,
|
||||
jni::alias_ref<jstring> moduleName) {
|
||||
auto env = jni::Environment::current();
|
||||
|
||||
const char *moduleNameValue =
|
||||
env->GetStringUTFChars(moduleName.get(), JNI_FALSE);
|
||||
auto instance = makeCxxInstance(surfaceId, moduleNameValue);
|
||||
env->ReleaseStringUTFChars(moduleName.get(), moduleNameValue);
|
||||
|
||||
return makeCxxInstance(surfaceId, moduleNameValue);
|
||||
return instance;
|
||||
}
|
||||
|
||||
void SurfaceHandlerBinding::setLayoutConstraints(
|
||||
|
||||
Reference in new issue
Block a user