{"action":"created","issue":{"url":"https://api.github.com/repos/HowardHinnant/date/issues/150","repository_url":"https://api.github.com/repos/HowardHinnant/date","labels_url":"https://api.github.com/repos/HowardHinnant/date/issues/150/labels{/name}","comments_url":"https://api.github.com/repos/HowardHinnant/date/issues/150/comments","events_url":"https://api.github.com/repos/HowardHinnant/date/issues/150/events","html_url":"https://github.com/HowardHinnant/date/pull/150","id":225120392,"number":150,"title":"Two error handling fixes (one fixing uninitialized stack memory being accessed)","user":{"login":"jaakristioja","id":2684083,"avatar_url":"https://avatars1.githubusercontent.com/u/2684083?v=3","gravatar_id":"","url":"https://api.github.com/users/jaakristioja","html_url":"https://github.com/jaakristioja","followers_url":"https://api.github.com/users/jaakristioja/followers","following_url":"https://api.github.com/users/jaakristioja/following{/other_user}","gists_url":"https://api.github.com/users/jaakristioja/gists{/gist_id}","starred_url":"https://api.github.com/users/jaakristioja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaakristioja/subscriptions","organizations_url":"https://api.github.com/users/jaakristioja/orgs","repos_url":"https://api.github.com/users/jaakristioja/repos","events_url":"https://api.github.com/users/jaakristioja/events{/privacy}","received_events_url":"https://api.github.com/users/jaakristioja/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-04-28T15:47:31Z","updated_at":"2017-05-01T12:45:41Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/HowardHinnant/date/pulls/150","html_url":"https://github.com/HowardHinnant/date/pull/150","diff_url":"https://github.com/HowardHinnant/date/pull/150.diff","patch_url":"https://github.com/HowardHinnant/date/pull/150.patch"},"body":"c7bc7fe fixes the a message of a `std::runtime_error` containing a trailing semicolon and space character but no following error message if the related `strerror_r` call fails.\r\n\r\nbd09561 fixes the incompatibility with the GNU C library where `strerror_r` is instead defined in an non-portable XSI-incompatible manner. I discovered this issue because of a compiler warning about comparing the return value of `strerror_r` (a pointer) to an integer `0` on GNU platforms. Regardless of the warning, the code still compiled, and resulted in uninitialized stack memory being read from the `message` buffer:\r\n\r\n- Before c7bc7fe:\r\n  - if the GNU-specific `strerror_r` succeeded, the `if (strerror_r(errno, message, sizeof(message)) != 0)` branch was taken, `message` was set to the empty string (regardless of whether `strerror_r` wrote to it) and later streamed to `os`. No undefined behavior resulted, but the actual error message was ignored.\r\n  -  if the GNU-specific `strerror_r` failed and returned `nullptr`, the conditional would not trigger and the uninitialized `message` buffer was streamed to `os`.\r\n- After c7bc7fe:\r\n  - if the GNU-specific `strerror_r` succeeded, the `if (strerror_r(errno, message, sizeof(message)) == 0)` condition was not triggered and `message` was not streamed to `os`. No undefined behavior resulted, but the actual error message was ignored.\r\n  -  if the GNU-specific `strerror_r` failed and returned `nullptr`, the conditional triggered the uninitialized `message` buffer was streamed to `os`."},"comment":{"url":"https://api.github.com/repos/HowardHinnant/date/issues/comments/298328268","html_url":"https://github.com/HowardHinnant/date/pull/150#issuecomment-298328268","issue_url":"https://api.github.com/repos/HowardHinnant/date/issues/150","id":298328268,"user":{"login":"HowardHinnant","id":6708789,"avatar_url":"https://avatars1.githubusercontent.com/u/6708789?v=3","gravatar_id":"","url":"https://api.github.com/users/HowardHinnant","html_url":"https://github.com/HowardHinnant","followers_url":"https://api.github.com/users/HowardHinnant/followers","following_url":"https://api.github.com/users/HowardHinnant/following{/other_user}","gists_url":"https://api.github.com/users/HowardHinnant/gists{/gist_id}","starred_url":"https://api.github.com/users/HowardHinnant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HowardHinnant/subscriptions","organizations_url":"https://api.github.com/users/HowardHinnant/orgs","repos_url":"https://api.github.com/users/HowardHinnant/repos","events_url":"https://api.github.com/users/HowardHinnant/events{/privacy}","received_events_url":"https://api.github.com/users/HowardHinnant/received_events","type":"User","site_admin":false},"created_at":"2017-05-01T12:45:41Z","updated_at":"2017-05-01T12:45:41Z","body":"I like your `system_error(erro, system_category(), \"realpath failure: errno = \" + to_string(errno))` even better!  Want to code that up?  And add your name to the copyright list in tz.cpp if you want (it is encouraged but not required).  You can just edit your branch and push, and it will update this P/R.  And then I'll squash it down to a single commit prior to merge."}}
{"actor":{"display_login":"HowardHinnant"}}