)]}'
{
  "commit": "8cb442f4dd0d4ab490aa0d64f9345400c1fca3ed",
  "tree": "d3b9f096d4e521fcf39dcc3866e943206f606722",
  "parents": [
    "8a1772a0c5c447df2d18edf33ec4603a8c9c04a6"
  ],
  "author": {
    "name": "David Benjamin",
    "email": "davidben@google.com",
    "time": "Wed Jan 29 17:49:54 2025 -0500"
  },
  "committer": {
    "name": "David Benjamin",
    "email": "davidben@google.com",
    "time": "Wed Jan 29 17:49:54 2025 -0500"
  },
  "message": "Fix invalid function pointer cast in cpuinfo.c\n\nWhile casting function pointers is allowed in C, the function must\nultimately be called through a pointer with the same type signature as\nthe function itself. Type signature mismatches, even decaying T* to\nvoid* is undefined behavior.\n\nUBSan flags this with -fsanitize\u003dfunction. The easiest way I found to\nrepro this was:\n\n    CC\u003dclang-18 CXX\u003dclang++-18 \\\n    CFLAGS\u003d\"-fsanitize\u003dfunction -fno-sanitize-recover\u003dfunction\" \\\n    CXXFLAGS\u003d\"-fsanitize\u003dfunction -fno-sanitize-recover\u003dfunction\" \\\n    cmake -GNinja -B build -DCPUINFO_BUILD_BENCHMARKS\u003dOFF\n\n    ninja -C build\n\n    ./build/cpu-info\n\nThat gives the following error:\n\n    [...]/src/linux/multiline.c:85:11: runtime error: call to function parse_line through pointer to incorrect function type \u0027bool (*)(const char *, const char *, void *, unsigned long)\u0027\n    cpuinfo.c: note: parse_line defined here\n    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior [...]/src/linux/multiline.c:85:11\n\nThe fix is fairly straightforward: just keep the function at the type\nsignature the expected, and cast void* instead the function instead.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7df72aba50ee7d414c4a3330f444c45a51891324",
      "old_mode": 33188,
      "old_path": "src/x86/linux/cpuinfo.c",
      "new_id": "8f038b07026e5ae4c471a1d64244e5d8d023e979",
      "new_mode": 33188,
      "new_path": "src/x86/linux/cpuinfo.c"
    }
  ]
}
