Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1752654325, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"bd5640d1b5f84ec1662a3ea588aad2ab", "commit": {"type":"commit", "time": 1567780251, "time_ofs": 60, "oid_tree": { "oid": "3db9b733b49f07739b2d3784e0c6f8744d20d7b4", "alias": []}, "oid":{ "oid": "ed79eedb472a7e049973fcd76c33ec3e14c5b490", "alias": []}, "msg": "sul_compare: prevent integer overflow bug", "sig_commit": { "git_time": { "time": 1567780251, "offset": 60 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1566735076, "offset": 180 }, "name": "Sviatoslav Grebenchucov", "email": "m1r4gexx@gmail.com", "md5": "a71ff5cfb50890515013a68ff16c6c89" }}, "body": "sul_compare: prevent integer overflow bug\n" , "diff": "diff --git a/lib/core-net/sorted-usec-list.c b/lib/core-net/sorted-usec-list.c\nindex c547807..97480fb 100644\n--- a/lib/core-net/sorted-usec-list.c\n+++ b/lib/core-net/sorted-usec-list.c\n@@ -27,8 +27,20 @@\n static int\n sul_compare(const lws_dll2_t *d, const lws_dll2_t *i)\n {\n-\treturn ((lws_sorted_usec_list_t *)d)-\u003eus -\n-\t\t\t((lws_sorted_usec_list_t *)i)-\u003eus;\n+\tlws_usec_t a \u003d ((lws_sorted_usec_list_t *)d)-\u003eus;\n+\tlws_usec_t b \u003d ((lws_sorted_usec_list_t *)i)-\u003eus;\n+\n+\t/*\n+\t * Simply returning (a - b) in an int\n+\t * may lead to an integer overflow bug\n+\t */\n+\n+\tif (a \u003e b)\n+\t\treturn 1;\n+\tif (a \u003c b)\n+\t\treturn -1;\n+\n+\treturn 0;\n }\n \n int\n","s":{"c":1752654325,"u": 1519}} ],"g": 2267,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}