{"action":"created","issue":{"url":"https://api.github.com/repos/kuina/Kuin/issues/36","repository_url":"https://api.github.com/repos/kuina/Kuin","labels_url":"https://api.github.com/repos/kuina/Kuin/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/kuina/Kuin/issues/36/comments","events_url":"https://api.github.com/repos/kuina/Kuin/issues/36/events","html_url":"https://github.com/kuina/Kuin/issues/36","id":225230215,"number":36,"title":"file@Reader.readInt 33字以上の入力で異常終了","user":{"login":"tatt61880","id":2398152,"avatar_url":"https://avatars0.githubusercontent.com/u/2398152?v=4","gravatar_id":"","url":"https://api.github.com/users/tatt61880","html_url":"https://github.com/tatt61880","followers_url":"https://api.github.com/users/tatt61880/followers","following_url":"https://api.github.com/users/tatt61880/following{/other_user}","gists_url":"https://api.github.com/users/tatt61880/gists{/gist_id}","starred_url":"https://api.github.com/users/tatt61880/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tatt61880/subscriptions","organizations_url":"https://api.github.com/users/tatt61880/orgs","repos_url":"https://api.github.com/users/tatt61880/repos","events_url":"https://api.github.com/users/tatt61880/events{/privacy}","received_events_url":"https://api.github.com/users/tatt61880/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-04-29T03:28:43Z","updated_at":"2017-09-15T16:20:43Z","closed_at":"2017-09-15T16:20:43Z","author_association":"CONTRIBUTOR","body":"1行目に33桁以上の数を入力したinput.txt を用意し、下記を実行すると異常終了します。\r\n```\r\nfunc main()\r\n\tvar filePath: []char :: \"input.txt\"\r\n\tvar filePtr: file@Reader :: file@makeReader(filePath)\r\n\tif(filePtr =& null)\r\n\t\tdo cui@print(\"[Error] ファイル読み込みエラー: \\{filePath}\")\r\n\t\tret\r\n\tend if\r\n\ttry e\r\n\t\tif(!filePtr.term())\r\n\t\t\tvar x: int :: filePtr.readInt()\r\n\t\t\tdo cui@print(\"\\{x}\")\r\n\t\tend if\r\n\tcatch\r\n\t\tdo cui@print(\"[Error] filePtr.readInt() failed.\\ne.code: \\{e.code}\\ne.msg: \\{e.msg}\\n\")\r\n\tfinally\r\n\tend try\r\nend func\r\n```\r\n\r\n\r\nhttps://github.com/kuina/Kuin/blob/d62eb04e8933f628f1f25687e11fb8a01fb12837/src/lib_common/file.c#L154-L155\r\nlib_common/file.c の _streamReadInt関数内で、\r\n```\r\n\t\tif (ptr == 32)\r\n\t\t\tASSERT(False);\r\n```\r\nとなっている箇所を、下記のように変更すると良さそうです。\r\n```\r\n\t\tTHROWDBG(ptr == 32, 0x0917xxxx, L\"file@Reader.readInt: buffer overflow\");\r\n```\r\nちゃんと確認していないですが、おそらく _streamReadFloat関数も同様です。\r\n\r\nまた、32桁以下で かつ intの範囲を超えた場合には、\r\n```\r\nAn exception of '0x00001000' occurred.\r\nUser defined exception.\r\n```\r\nと表示されます。\r\n「User defined exception.」ではないので、値を変更した方が良いと思います。\r\n（いろんな箇所に THROW(0x1000, L\"\"); があるので、0x1000は暫定で定めた値だろうとは思います。）"},"comment":{"url":"https://api.github.com/repos/kuina/Kuin/issues/comments/329830234","html_url":"https://github.com/kuina/Kuin/issues/36#issuecomment-329830234","issue_url":"https://api.github.com/repos/kuina/Kuin/issues/36","id":329830234,"user":{"login":"tatt61880","id":2398152,"avatar_url":"https://avatars0.githubusercontent.com/u/2398152?v=4","gravatar_id":"","url":"https://api.github.com/users/tatt61880","html_url":"https://github.com/tatt61880","followers_url":"https://api.github.com/users/tatt61880/followers","following_url":"https://api.github.com/users/tatt61880/following{/other_user}","gists_url":"https://api.github.com/users/tatt61880/gists{/gist_id}","starred_url":"https://api.github.com/users/tatt61880/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tatt61880/subscriptions","organizations_url":"https://api.github.com/users/tatt61880/orgs","repos_url":"https://api.github.com/users/tatt61880/repos","events_url":"https://api.github.com/users/tatt61880/events{/privacy}","received_events_url":"https://api.github.com/users/tatt61880/received_events","type":"User","site_admin":false},"created_at":"2017-09-15T16:20:43Z","updated_at":"2017-09-15T16:20:43Z","author_association":"CONTRIBUTOR","body":"修正ありがとうございます！\r\nE9170008例外が発生し、異常終了はしないことを確認しました。\r\nクローズします。"}}
{"actor":{"display_login":"tatt61880"}}