)]}'
{
  "commit": "88c18bb366617786a5b90e481ff46fe91a4fb359",
  "tree": "1646c625ca64293c507473e727ddd37af8fed978",
  "parents": [
    "b9a7e979fac370a2db1da4f3600bad92eaa32e13"
  ],
  "author": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Tue Nov 24 18:21:12 2026 -0600"
  },
  "committer": {
    "name": "Behdad Esfahbod",
    "email": "behdad@behdad.org",
    "time": "Tue Nov 24 18:39:52 2026 -0600"
  },
  "message": "[wasm] Fix stale pointers and reentry around a module\u0027s allocator\n\nWhen a module exports malloc() and free(), the runtime keeps no heap\nof its own in the instance and runs the module\u0027s allocator for the\nmemory we allocate in the module, in the middle of our functions.\nTwo things went wrong with that.\n\nThe allocator can grow the module\u0027s memory, and a runtime built\nwithout hardware bounds checks moves the memory when it grows.  Our\nfunctions kept native pointers into the module\u0027s memory across\nmodule_malloc(), module_free() and wasm_runtime_module_dup_data(),\nand wrote through them afterwards.  On such a runtime\nface_copy_table() crashed writing the blob back.\n\nAnd the allocator can call our functions.  A module\u0027s malloc()\ncalled buffer_set_contents() while buffer_copy_contents() was copying\nthe buffer into the module; the buffer moved, and the copy read freed\nmemory.  That one does not depend on how the runtime is built.\n\nTake pointers into a module\u0027s memory again after every call that may\nrun the module\u0027s allocator, and free last where nothing is written\nafter.  Count the allocation calls in progress in the plan, and have\nevery host function refuse while there is one, which ends the\nmodule\u0027s call.  An instance that is still being made, which has no\nplan to count in, gets no memory from us.\n\nWith the limits compiled in such a module is not run in the first\nplace; this is for builds with HB_NO_WASM_BUDGET.\n\nTwo test modules: one whose allocator enlarges the memory at every\ncall and which checks what we wrote, and one whose allocator calls\nback.  ASan reported both before the fix, the first with a runtime\nbuilt with -DWAMR_DISABLE_HW_BOUND_CHECK\u003d1.\n\nCo-Authored-By: Claude Fable 5.2 \u003cnoreply@anthropic.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "24b067fd04245996dfcdeeacc40131ce6500b2c4",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-api-blob.hh",
      "new_id": "2f073451bdf14f410e13275dac2059d3278091f2",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-api-blob.hh"
    },
    {
      "type": "modify",
      "old_id": "47be2001fb43ffc3a2738ee2beb5b16feef3a738",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-api-buffer.hh",
      "new_id": "2186c55b27dc8e9b478ee922b6594834a01f4fde",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-api-buffer.hh"
    },
    {
      "type": "modify",
      "old_id": "a99bc2dbbe8be6d71096a70b4498dfe44791fa35",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-api-face.hh",
      "new_id": "56692733bbd9405451b0e1bcb0efe5f4f01914cf",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-api-face.hh"
    },
    {
      "type": "modify",
      "old_id": "8f907f1a8af0cf8b12b4475fe7e4b6bf370ed85a",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-api-font.hh",
      "new_id": "f5e44ee3d604f5fc5b7b5135b216773f71ef908e",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-api-font.hh"
    },
    {
      "type": "modify",
      "old_id": "e542de73901e260718054b804bd4baa84c0cb022",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-api-shape.hh",
      "new_id": "4f9211d395391584b87526b5766a4e0930fa5706",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-api-shape.hh"
    },
    {
      "type": "modify",
      "old_id": "01ea0a94032bfd789f9ebe730bbf619c1bdbe768",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-api.hh",
      "new_id": "6ffcf594d1d994a158ba04d49acd6126436f91b0",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-api.hh"
    },
    {
      "type": "modify",
      "old_id": "c330fa3bdffdbb7aad2718f016374d730f8684a4",
      "old_mode": 33188,
      "old_path": "src/hb-wasm-shape.cc",
      "new_id": "e0296754656d138c77e041a8931e09afb0154f13",
      "new_mode": 33188,
      "new_path": "src/hb-wasm-shape.cc"
    },
    {
      "type": "modify",
      "old_id": "d706f4d7955152da7639e5702098aff76a54a050",
      "old_mode": 33188,
      "old_path": "test/api/fonts/generate-wasm-api-font.py",
      "new_id": "83dd65d0195b90ffeddc8d655b56f16f0d48f1c6",
      "new_mode": 33188,
      "new_path": "test/api/fonts/generate-wasm-api-font.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a6b3f4f259359424fe6edcc65ec8f831c28006f3",
      "new_mode": 33188,
      "new_path": "test/api/fonts/wasm-allocator-grow.ttf"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e033c6d2c7dea60886092ad398b33d9aff3a358d",
      "new_mode": 33188,
      "new_path": "test/api/fonts/wasm-allocator-reenter.ttf"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "70b450b66cef68371c0123fa1ce8d4024efac6d2",
      "new_mode": 33188,
      "new_path": "test/api/fonts/wasm-own-allocator.cc"
    },
    {
      "type": "modify",
      "old_id": "bfa243d2f0047abb5063c404ed09daf9f5fb4747",
      "old_mode": 33188,
      "old_path": "test/api/test-wasm.c",
      "new_id": "d9ba12e51d65dd5f8425ae07ec0482f8e84aaac1",
      "new_mode": 33188,
      "new_path": "test/api/test-wasm.c"
    }
  ]
}
