frida-java-bridge 7.0.5 → 7.0.6

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 +13 -12
  2. package/package.json +1 -1
package/lib/android.js CHANGED
@@ -967,14 +967,14 @@ export function getArtClassSpec (vm) {
967
967
  const fInfo = {
968
968
  artArrayLengthSize: 4,
969
969
  artArrayEntrySize: fieldSpec.size,
970
- // java/lang/Integer has 11 fields on Android 16.
971
- artArrayMax: 20
970
+ // java/io/File has 15 fields on Android 16.
971
+ artArrayMax: 25
972
972
  };
973
973
 
974
974
  const mInfo = {
975
975
  artArrayLengthSize: pointerSize,
976
976
  artArrayEntrySize: methodSpec.size,
977
- // java/lang/Integer has 66 methods on Android 16.
977
+ // java/io/File has 63 methods on Android 16.
978
978
  artArrayMax: 100
979
979
  };
980
980
 
@@ -985,7 +985,7 @@ export function getArtClassSpec (vm) {
985
985
  }
986
986
 
987
987
  const length = (lengthSize === 4) ? header.readU32() : header.readU64().valueOf();
988
- if (length === 0) {
988
+ if (length <= 0) {
989
989
  return null;
990
990
  }
991
991
 
@@ -1002,7 +1002,8 @@ export function getArtClassSpec (vm) {
1002
1002
  return false;
1003
1003
  }
1004
1004
 
1005
- for (let i = 0; i !== Math.min(artArray.length, info.artArrayMax); i++) {
1005
+ const artArrayEnd = Math.min(artArray.length, info.artArrayMax);
1006
+ for (let i = 0; i !== artArrayEnd; i++) {
1006
1007
  const fieldPtr = artArray.data.add(i * info.artArrayEntrySize);
1007
1008
  if (fieldPtr.equals(needle)) {
1008
1009
  return true;
@@ -1014,7 +1015,7 @@ export function getArtClassSpec (vm) {
1014
1015
  return false;
1015
1016
  };
1016
1017
 
1017
- const clazz = env.findClass('java/lang/Integer');
1018
+ const clazz = env.findClass('java/io/File');
1018
1019
  const clazzRef = env.newGlobalRef(clazz);
1019
1020
 
1020
1021
  try {
@@ -1023,8 +1024,8 @@ export function getArtClassSpec (vm) {
1023
1024
  object = getApi()['art::JavaVMExt::DecodeGlobal'](vm, thread, clazzRef);
1024
1025
  });
1025
1026
 
1026
- const fieldInstance = env.getFieldId(clazzRef, 'value', 'I');
1027
- const fieldStatic = env.getStaticFieldId(clazzRef, 'TYPE', 'Ljava/lang/Class;');
1027
+ const fieldInstance = env.getFieldId(clazzRef, 'path', 'Ljava/lang/String;');
1028
+ const fieldStatic = env.getStaticFieldId(clazzRef, 'separatorChar', 'C');
1028
1029
 
1029
1030
  let offsetStatic = -1;
1030
1031
  let offsetInstance = -1;
@@ -1037,20 +1038,20 @@ export function getArtClassSpec (vm) {
1037
1038
  }
1038
1039
  }
1039
1040
  if (offsetInstance === -1 || offsetStatic === -1) {
1040
- throw new Error('Unable to find fields in java/lang/Integer; please file a bug');
1041
+ throw new Error('Unable to find fields in java/io/File; please file a bug');
1041
1042
  }
1042
1043
  const sfieldOffset = (offsetInstance !== offsetStatic) ? offsetStatic : 0;
1043
1044
  const ifieldOffset = offsetInstance;
1044
1045
 
1045
1046
  let offsetMethods = -1;
1046
- const methodInstance = env.getMethodId(clazzRef, 'intValue', '()I');
1047
+ const methodInstance = env.getMethodId(clazzRef, 'length', '()J');
1047
1048
  for (let offset = 0; offset !== MAX_OFFSET; offset += 4) {
1048
1049
  if (offsetMethods === -1 && hasEntry(object, offset, methodInstance, mInfo)) {
1049
1050
  offsetMethods = offset;
1050
1051
  }
1051
1052
  }
1052
1053
  if (offsetMethods === -1) {
1053
- throw new Error('Unable to find methods in java/lang/Integer; please file a bug');
1054
+ throw new Error('Unable to find methods in java/io/File; please file a bug');
1054
1055
  }
1055
1056
 
1056
1057
  let offsetCopiedMethods = -1;
@@ -1063,7 +1064,7 @@ export function getArtClassSpec (vm) {
1063
1064
  }
1064
1065
  }
1065
1066
  if (offsetCopiedMethods === -1) {
1066
- throw new Error('Unable to find copied methods in java/lang/Integer; please file a bug');
1067
+ throw new Error('Unable to find copied methods in java/io/File; please file a bug');
1067
1068
  }
1068
1069
 
1069
1070
  spec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frida-java-bridge",
3
- "version": "7.0.5",
3
+ "version": "7.0.6",
4
4
  "description": "Java runtime interop from Frida",
5
5
  "keywords": [
6
6
  "frida-gum",