{"action":"created","issue":{"url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy/issues/84","repository_url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy","labels_url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy/issues/84/comments","events_url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy/issues/84/events","html_url":"https://github.com/Cyan4973/FiniteStateEntropy/issues/84","id":265730924,"number":84,"title":"Integer division by zero in FSE_normalizeM2","user":{"login":"makush","id":11277044,"avatar_url":"https://avatars0.githubusercontent.com/u/11277044?v=4","gravatar_id":"","url":"https://api.github.com/users/makush","html_url":"https://github.com/makush","followers_url":"https://api.github.com/users/makush/followers","following_url":"https://api.github.com/users/makush/following{/other_user}","gists_url":"https://api.github.com/users/makush/gists{/gist_id}","starred_url":"https://api.github.com/users/makush/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makush/subscriptions","organizations_url":"https://api.github.com/users/makush/orgs","repos_url":"https://api.github.com/users/makush/repos","events_url":"https://api.github.com/users/makush/events{/privacy}","received_events_url":"https://api.github.com/users/makush/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-10-16T11:07:40Z","updated_at":"2018-03-13T20:33:26Z","closed_at":null,"author_association":"NONE","body":"Hi, I get sometimes integer division by zero error from FSE_normalizeM2, when having large max symbol values. Specifically, I am using following compiler defines to compile FSE:\r\n\r\nFSE_DEFAULT_MEMORY_USAGE=14\r\nFSE_MAX_MEMORY_USAGE=16\r\nFSEU16_DEFAULT_MEMORY_USAGE=14\r\nFSEU16_MAX_MEMORY_USAGE=16\r\nFSEU16_MAX_SYMBOL_VALUE=4095\r\n\r\nPlease find below example code that will reproduce the error. \r\n\r\n```\r\n#include \"fse.h\"\r\n\r\nvoid test()\r\n{\r\n\tuint16_t sourceBuffer[64] =\r\n\t{\r\n\t\t4048, 1072, 1532, 1936, 2252, 2460, 2536, 2480, 2292, 1988, 1596, 1140, 668, 200, \r\n\t\t207, 535, 747, 839, 795, 615, 327, 64, 512, 988, 1456, 1868, 2208, 2432, 2532,\r\n\t\t2500, 2332, 2048, 1672, 1224, 748, 280, 139, 483, 723, 831, 811, 659, 383, 11,\r\n\t\t432, 904, 1376, 1800, 2152, 2404, 2524, 2516, 2372, 2104, 1744, 1304, 832, 364,\r\n\t\t71, 431, 687, 823, 827, 263\r\n\t};\r\n\tuint16_t destinationBuffer[64];\r\n\tstatic_assert(FSEU16_MAX_SYMBOL_VALUE == 4095, \"Custom fseu16 max symbol value\");\r\n\tFSE_compressU16(destinationBuffer, 64, sourceBuffer, 64, 4048, 13);\r\n\t/* -> Integer division by zero at fse_compress.c line 540 (FSE_normalizeM2) */\r\n}\r\n\r\n```\r\n\r\nThanks,\r\nMarkus"},"comment":{"url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy/issues/comments/372808702","html_url":"https://github.com/Cyan4973/FiniteStateEntropy/issues/84#issuecomment-372808702","issue_url":"https://api.github.com/repos/Cyan4973/FiniteStateEntropy/issues/84","id":372808702,"user":{"login":"kozross","id":8463904,"avatar_url":"https://avatars2.githubusercontent.com/u/8463904?v=4","gravatar_id":"","url":"https://api.github.com/users/kozross","html_url":"https://github.com/kozross","followers_url":"https://api.github.com/users/kozross/followers","following_url":"https://api.github.com/users/kozross/following{/other_user}","gists_url":"https://api.github.com/users/kozross/gists{/gist_id}","starred_url":"https://api.github.com/users/kozross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kozross/subscriptions","organizations_url":"https://api.github.com/users/kozross/orgs","repos_url":"https://api.github.com/users/kozross/repos","events_url":"https://api.github.com/users/kozross/events{/privacy}","received_events_url":"https://api.github.com/users/kozross/received_events","type":"User","site_admin":false},"created_at":"2018-03-13T20:33:26Z","updated_at":"2018-03-13T20:33:26Z","author_association":"NONE","body":"@Cyan4973 The main reason I ask is because I maintain [awesome-c][1], and I would like to include your work, but this issue has me concerned.\r\n\r\n[1]: https://github.com/kozross/awesome-c.git"}}
{"actor":{"display_login":"kozross"}}