1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Fix crash on Android 2.2

* src/android-asset.h (AAssetManager_open): Initialize desc and
asset to NULL, lest `desc' be accessed uninitialized if C_NAME
does not exist in the directory tree.
This commit is contained in:
Po Lu 2025-11-12 01:13:46 +08:00
parent a71ba898db
commit ca4af1768d

View file

@ -186,15 +186,13 @@ static AAsset *
AAssetManager_open (AAssetManager *manager, const char *c_name,
int mode)
{
jobject desc;
jobject desc = NULL;
jstring name;
AAsset *asset;
AAsset *asset = NULL;
const char *asset_dir;
jlong st_size = -1;
/* Push a local frame. */
asset = NULL;
(*(manager->env))->PushLocalFrame (manager->env, 3);
if ((*(manager->env))->ExceptionCheck (manager->env))
@ -226,8 +224,6 @@ AAssetManager_open (AAssetManager *manager, const char *c_name,
stream directly upon the first attempt to read from the asset,
sidestepping the intermediate AssetFileDescriptor. */
desc = NULL;
if (st_size < 0)
/* Otherwise attempt to open an ``AssetFileDescriptor''. */
desc = (*(manager->env))->CallObjectMethod (manager->env,