frida-java-bridge 7.0.2 → 7.0.3

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.
package/lib/android.js CHANGED
@@ -950,8 +950,6 @@ function tryGetArtClassLinkerSpec (runtime, runtimeSpec) {
950
950
 
951
951
  if (spec !== null) {
952
952
  cachedArtClassLinkerSpec = spec;
953
- } else {
954
- throw new Error('Unable to determine ClassLinker field offsets');
955
953
  }
956
954
 
957
955
  return spec;
@@ -965,27 +963,36 @@ export function getArtClassSpec (vm) {
965
963
  return null;
966
964
  }
967
965
 
968
- if (apiLevel < 24) {
969
- return null;
970
- }
971
-
972
- let base, cmo;
973
- if (apiLevel >= 26) {
974
- base = 40;
975
- cmo = 116;
966
+ if (apiLevel >= 34) {
967
+ return {
968
+ offset: {
969
+ ifields: 0x28,
970
+ methods: 0x28 + 0x8,
971
+ sfields: 0,
972
+ copiedMethodsOffset: 0x6c,
973
+ }
974
+ };
975
+ } else if (apiLevel >= 26) {
976
+ return {
977
+ offset: {
978
+ ifields: 0x28,
979
+ methods: 0x28 + 0x8,
980
+ sfields: 0x28 + 0x10,
981
+ copiedMethodsOffset: 0x74,
982
+ }
983
+ };
984
+ } else if (apiLevel >= 24) {
985
+ return {
986
+ offset: {
987
+ ifields: 0x38,
988
+ methods: 0x38 + 0x8,
989
+ sfields: 0x38 + 0x10,
990
+ copiedMethodsOffset: 0x7c,
991
+ }
992
+ };
976
993
  } else {
977
- base = 56;
978
- cmo = 124;
994
+ return null;
979
995
  }
980
-
981
- return {
982
- offset: {
983
- ifields: base,
984
- methods: base + 8,
985
- sfields: base + 16,
986
- copiedMethodsOffset: cmo
987
- }
988
- };
989
996
  }
990
997
 
991
998
  function _getArtMethodSpec (vm) {
@@ -263,6 +263,7 @@ model_new (jclass class_handle,
263
263
  art_api.class_offset_sfields
264
264
  };
265
265
  guint field_array_cursor;
266
+ gboolean merged_fields = art_api.class_offset_sfields == 0;
266
267
 
267
268
  elements = read_art_array (class_object, art_api.class_offset_methods, sizeof (gsize), NULL);
268
269
  n = *(guint16 *) (class_object + art_api.class_offset_copied_methods_offset);
@@ -297,7 +298,11 @@ model_new (jclass class_handle,
297
298
  {
298
299
  jboolean is_static;
299
300
 
300
- is_static = field_array_cursor == 1;
301
+ if (field_arrays[field_array_cursor] == 0)
302
+ continue;
303
+
304
+ if (!merged_fields)
305
+ is_static = field_array_cursor == 1;
301
306
 
302
307
  elements = read_art_array (class_object, field_arrays[field_array_cursor], sizeof (guint32), &n);
303
308
  for (i = 0; i != n; i++)
@@ -311,6 +316,8 @@ model_new (jclass class_handle,
311
316
  id = elements + (i * art_api.field_size);
312
317
 
313
318
  access_flags = *(guint32 *) (id + art_api.field_offset_access_flags);
319
+ if (merged_fields)
320
+ is_static = (access_flags & kAccStatic) != 0;
314
321
  field = to_reflected_field (env, class_handle, id, is_static);
315
322
  name = call_object_method (env, field, java_api.field.get_name);
316
323
  name_str = get_string_utf_chars (env, name, NULL);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-java-bridge",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "description": "Java runtime interop from Frida",
5
5
  "keywords": [
6
6
  "frida-gum",