frida-java-bridge 7.0.7 → 7.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/android.js +15 -5
  2. package/package.json +1 -1
package/lib/android.js CHANGED
@@ -312,6 +312,7 @@ function _getApi () {
312
312
 
313
313
  // Android >= 11
314
314
  _ZN3art3jni12JniIdManager14DecodeMethodIdEP10_jmethodID: ['art::jni::JniIdManager::DecodeMethodId', 'pointer', ['pointer', 'pointer']],
315
+ _ZN3art3jni12JniIdManager13DecodeFieldIdEP9_jfieldID: ['art::jni::JniIdManager::DecodeFieldId', 'pointer', ['pointer', 'pointer']],
315
316
  _ZN3art11interpreter18GetNterpEntryPointEv: ['art::interpreter::GetNterpEntryPoint', 'pointer', []],
316
317
 
317
318
  _ZN3art7Monitor17TranslateLocationEPNS_9ArtMethodEjPPKcPi: ['art::Monitor::TranslateLocation', 'void', ['pointer', 'uint32', 'pointer', 'pointer']]
@@ -370,6 +371,7 @@ function _getApi () {
370
371
  '_ZN3art3Dbg20ManageDeoptimizationEv',
371
372
  '_ZN3art3Dbg9gRegistryE',
372
373
  '_ZN3art3jni12JniIdManager14DecodeMethodIdEP10_jmethodID',
374
+ '_ZN3art3jni12JniIdManager13DecodeFieldIdEP9_jfieldID',
373
375
  '_ZN3art11interpreter18GetNterpEntryPointEv',
374
376
  '_ZN3art7Monitor17TranslateLocationEPNS_9ArtMethodEjPPKcPi'
375
377
  ])
@@ -1024,8 +1026,8 @@ export function getArtClassSpec (vm) {
1024
1026
  object = getApi()['art::JavaVMExt::DecodeGlobal'](vm, thread, clazzRef);
1025
1027
  });
1026
1028
 
1027
- const fieldInstance = env.getFieldId(clazzRef, 'name', 'Ljava/lang/String;');
1028
- const fieldStatic = env.getStaticFieldId(clazzRef, 'MAX_PRIORITY', 'I');
1029
+ const fieldInstance = unwrapFieldId(env.getFieldId(clazzRef, 'name', 'Ljava/lang/String;'));
1030
+ const fieldStatic = unwrapFieldId(env.getStaticFieldId(clazzRef, 'MAX_PRIORITY', 'I'));
1029
1031
 
1030
1032
  let offsetStatic = -1;
1031
1033
  let offsetInstance = -1;
@@ -1044,7 +1046,7 @@ export function getArtClassSpec (vm) {
1044
1046
  const ifieldOffset = offsetInstance;
1045
1047
 
1046
1048
  let offsetMethods = -1;
1047
- const methodInstance = env.getMethodId(clazzRef, 'getName', '()Ljava/lang/String;');
1049
+ const methodInstance = unwrapMethodId(env.getMethodId(clazzRef, 'getName', '()Ljava/lang/String;'));
1048
1050
  for (let offset = 0; offset !== MAX_OFFSET; offset += 4) {
1049
1051
  if (offsetMethods === -1 && hasEntry(object, offset, methodInstance, mInfo)) {
1050
1052
  offsetMethods = offset;
@@ -2959,6 +2961,14 @@ export function revertGlobalPatches () {
2959
2961
  }
2960
2962
 
2961
2963
  function unwrapMethodId (methodId) {
2964
+ return unwrapGenericId(methodId, 'art::jni::JniIdManager::DecodeMethodId');
2965
+ }
2966
+
2967
+ function unwrapFieldId (fieldId) {
2968
+ return unwrapGenericId(fieldId, 'art::jni::JniIdManager::DecodeFieldId');
2969
+ }
2970
+
2971
+ function unwrapGenericId (genericId, apiMethod) {
2962
2972
  const api = getApi();
2963
2973
 
2964
2974
  const runtimeOffset = getArtRuntimeSpec(api).offset;
@@ -2972,11 +2982,11 @@ function unwrapMethodId (methodId) {
2972
2982
 
2973
2983
  if (jniIdsIndirection !== kPointer) {
2974
2984
  const jniIdManager = runtime.add(jniIdManagerOffset).readPointer();
2975
- return api['art::jni::JniIdManager::DecodeMethodId'](jniIdManager, methodId);
2985
+ return api[apiMethod](jniIdManager, genericId);
2976
2986
  }
2977
2987
  }
2978
2988
 
2979
- return methodId;
2989
+ return genericId;
2980
2990
  }
2981
2991
 
2982
2992
  const artQuickCodeReplacementTrampolineWriters = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-java-bridge",
3
- "version": "7.0.7",
3
+ "version": "7.0.8",
4
4
  "description": "Java runtime interop from Frida",
5
5
  "keywords": [
6
6
  "frida-gum",