mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +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:
committed by
Facebook GitHub Bot
parent
928519e4bd
commit
d9689b90a4
@@ -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