Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Method with argument of type array of array cannot be instrumented

Đang mở
#313 2 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java, javascript
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu trong lib/types.js, tại khu vực getArrayType(), sau đó tái hiện lỗi bằng phương thức được cung cấp TestA.array_of_array(byte[][]) và overload('[[B'). Xác minh cách tên kiểu mảng được chuyển đổi trước factory.use() và casting. Hoàn tất khi việc instrumentation thành công mà không có ClassNotFoundException và phương thức có thể được gọi thông qua Java bridge.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Hello,
I run into a problem while trying to instrument methods that take an array of array of byte as argument. For exemple:

package com.example.testclassloader;

public class TestA {
    public static int array_of_array(byte[][] arrays) {
        int size = 0;
        for (byte[] arr: arrays) {
            size += arr.length;
        }
        return size;
    }
}
[Android Emulator 5554::TestClassLoader ]-> Java.performNow(() => { })
[Android Emulator 5554::TestClassLoader ]-> TestA =  Java.use("com.example.testclassloader.TestA")
"<class: com.example.testclassloader.TestA>"
[Android Emulator 5554::TestClassLoader ]-> method = TestA.array_of_array
function
[Android Emulator 5554::TestClassLoader ]-> method.argumentTypes
[
    {
        "className": "[[B",
        "defaultValue": "0x0",
        "name": "[[B",
        "size": 1,
        "type": "pointer"
    }
]
[Android Emulator 5554::TestClassLoader ]-> method.overload('[[B').implementation = function(arrays) { s =
 method(arrays); console.log(s); return s; };
function

# after triggering the method in the app:

[Android Emulator 5554::TestClassLoader ]-> Process crashed: java.lang.ClassNotFoundException: Didn't find class "[L[B;" on path: DexPathList[[dex file "/data/data/com.example.testclassloader/code_cache/.overlay/base.apk/classes3.dex", zip file "/data/app/~~NRqmDlxjA4t3ccEvxe4Qlw==/com.example.testclassloader-JhUO40ypsrxE2AIa8f1k4A==/base.apk"],nativeLibraryDirectories=[/data/app/~~NRqmDlxjA4t3ccEvxe4Qlw==/com.example.testclassloader-JhUO40ypsrxE2AIa8f1k4A==/lib/x86_64, /system/lib64, /system_ext/lib64]]

I believe the issue comes from here: https://github.com/frida/frida-java-bridge/blob/1e23abb71fd26726d59627e4da3ad8e10ba849aa/lib/types.js#L480

I think something like this could be a rough solution, but I did not manage to get frida to use patched version of frida-java-bridge:

diff --git a/lib/types.js b/lib/types.js
index 6a0f977..9b8d91f 100644
--- a/lib/types.js
+++ b/lib/types.js
@@ -477,7 +477,13 @@ function getArrayType (typeName, unbox, factory) {
       }

       // The type name we get is not always the correct representation of the type so we make it so here.
-      const internalTypeName = '[L' + elementTypeName.replace(/\./g, '/') + ';';
+      let internalElementTypeName = '';
+      if (elementTypeName.replace[0] === '[') {
+        internalElementTypeName = elementTypeName.replace(/\./g, '/');
+      } else {
+        internalElementTypeName = 'L' + elementTypeName.replace(/\./g, '/') + ';';
+      }
+      const internalTypeName = '[' + internalElementTypeName;
       try {
         result.$w = factory.cast(arr, factory.use(internalTypeName), owned);
       } catch (e) {

PS: Is there some documentation for running a patched java-bridge? I tried https://github.com/frida/frida-tools?tab=readme-ov-file#loading-your-custom-frida-java-bridge and failled

Ngôn ngữ chính
JavaScript
Star
413
Fork
174
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của frida/frida-java-bridge

Tất cả issue của frida/frida-java-bridge

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.