This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 74adf2d1cf [Web] Fix RPC argument parsing for new FFI string/bytes 
types (#18683)
74adf2d1cf is described below

commit 74adf2d1cf7625780596ee2f6e936eda90c06c64
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Sat Jan 24 05:38:39 2026 +0800

    [Web] Fix RPC argument parsing for new FFI string/bytes types (#18683)
    
    ## Why
    Recent FFI refactoring added new type indices kTVMFFIStr (65) and
    kTVMFFIBytes (66). The RPC server didn't
    handle these, causing "cannot support type index 65/66" errors when
    Python sends string/bytes arguments via
    RPC.
    ## How
    `WriteFFIAny` in C++ writes the `type_index` twice for these types. The
    fix adds handlers that read and discard the duplicate type_index before
    reading the actual data.
---
 web/src/rpc_server.ts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/web/src/rpc_server.ts b/web/src/rpc_server.ts
index 3adab93be1..1fead65311 100644
--- a/web/src/rpc_server.ts
+++ b/web/src/rpc_server.ts
@@ -234,8 +234,15 @@ export class RPCServer {
         if (typeIndex === TypeIndex.kTVMFFIRawStr) {
           const str = Uint8ArrayToString(reader.readByteArray());
           args.push(str);
+        } else if (typeIndex === TypeIndex.kTVMFFIStr) {
+          reader.readU32(); // skip duplicate type_index
+          const str = Uint8ArrayToString(reader.readByteArray());
+          args.push(str);
         } else if (typeIndex === TypeIndex.kTVMFFIByteArrayPtr) {
           args.push(reader.readByteArray());
+        } else if (typeIndex === TypeIndex.kTVMFFIBytes) {
+          reader.readU32(); // skip duplicate type_index
+          args.push(reader.readByteArray());
         } else {
           throw new Error("cannot support type index " + typeIndex);
         }

Reply via email to