)]}'
{
  "commit": "d17008bc2914d62fd0af6a8f313604ae9f9a102c",
  "tree": "f79db0640f17f9e3ec8fbf337e58c8d521898901",
  "parents": [
    "9d5c1dc117d1ad881bbc76f6990ee1f9e9f8ef7f"
  ],
  "author": {
    "name": "Peter Maydell",
    "email": "peter.maydell@linaro.org",
    "time": "Mon Nov 09 14:56:31 2015 +0000"
  },
  "committer": {
    "name": "Peter Maydell",
    "email": "peter.maydell@linaro.org",
    "time": "Mon Nov 09 15:48:21 2015 +0000"
  },
  "message": "hw/timer/hpet.c: Avoid signed integer overflow which results in bugs on OSX\n\nSigned integer overflow in C is undefined behaviour, and the compiler\nis at liberty to assume it can never happen and optimize accordingly.\nIn particular, the subtractions in hpet_time_after() and hpet_time_after64()\nwere causing OSX clang to optimize the code such that it was prone to\nhangs and complaints about the main loop stalling (presumably because\nwe were spending all our time trying to service very high frequency\nHPET timer callbacks). The clang sanitizer confirms the UB:\n\nhw/timer/hpet.c:119:26: runtime error: signed integer overflow: -2146967296 - 2147003978 cannot be represented in type \u0027int\u0027\n\nFix this by doing the subtraction as an unsigned operation and then\nconverting to signed for the comparison.\n\nReported-by: Aaron Elkins \u003cthrecius@yahoo.com\u003e\nCc: qemu-stable@nongnu.org\nSigned-off-by: Peter Maydell \u003cpeter.maydell@linaro.org\u003e\nMessage-id: 1447080991-24995-1-git-send-email-peter.maydell@linaro.org\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3037bef72e4ea79739ca0f609fc9a692c5990889",
      "old_mode": 33188,
      "old_path": "hw/timer/hpet.c",
      "new_id": "7f0391c7860ab18a5dc8a5adf81dd2b01b6c0332",
      "new_mode": 33188,
      "new_path": "hw/timer/hpet.c"
    }
  ]
}
