{"action":"opened","issue":{"url":"https://api.github.com/repos/WebAssembly/binaryen/issues/277","repository_url":"https://api.github.com/repos/WebAssembly/binaryen","labels_url":"https://api.github.com/repos/WebAssembly/binaryen/issues/277/labels{/name}","comments_url":"https://api.github.com/repos/WebAssembly/binaryen/issues/277/comments","events_url":"https://api.github.com/repos/WebAssembly/binaryen/issues/277/events","html_url":"https://github.com/WebAssembly/binaryen/issues/277","id":143967558,"number":277,"title":"Suspect logic in src\\support\\safe_integer.cpp(40)","user":{"login":"juj","id":225351,"avatar_url":"https://avatars.githubusercontent.com/u/225351?v=3","gravatar_id":"","url":"https://api.github.com/users/juj","html_url":"https://github.com/juj","followers_url":"https://api.github.com/users/juj/followers","following_url":"https://api.github.com/users/juj/following{/other_user}","gists_url":"https://api.github.com/users/juj/gists{/gist_id}","starred_url":"https://api.github.com/users/juj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juj/subscriptions","organizations_url":"https://api.github.com/users/juj/orgs","repos_url":"https://api.github.com/users/juj/repos","events_url":"https://api.github.com/users/juj/events{/privacy}","received_events_url":"https://api.github.com/users/juj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-28T12:41:59Z","updated_at":"2016-03-28T12:41:59Z","closed_at":null,"body":"Reading the logic at https://github.com/WebAssembly/binaryen/blob/master/src/support/safe_integer.cpp#L37, the code first asserts that `x` is an integer in range `[0, uint32_max]`, but then proceeds to dynamically check if `x` is smaller than `uint32_max`. The ternary condition for this dynamic check never fails(?), so it would be equivalent to just have `return (uint32_t)x;`. Was the intent here to abort if `x` is not a integer in range, or is the intent to dynamically allow `x` to be an integer outside range, and clamp?"}}