Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Method with argument of type array of array cannot be instrumented

オープン
#313 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java, javascript
領域
devtools

調査の方向性

lib/types.js の getArrayType() 周辺から始め、次に、提供されているメソッド TestA.array_of_array(byte[][]) と overload('[[B) を使って失敗を再現します。factory.use() と casting の前に、配列型の名前がどのように変換されるかを確認します。ClassNotFoundException が発生せずにインストルメンテーションが成功し、Java bridge 経由でメソッドを呼び出せれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
JavaScript
スター
413
フォーク
174
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

frida/frida-java-bridge のほかの issue

frida/frida-java-bridge の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。