{"action":"opened","issue":{"url":"https://api.github.com/repos/xemul/criu/issues/157","repository_url":"https://api.github.com/repos/xemul/criu","labels_url":"https://api.github.com/repos/xemul/criu/issues/157/labels{/name}","comments_url":"https://api.github.com/repos/xemul/criu/issues/157/comments","events_url":"https://api.github.com/repos/xemul/criu/issues/157/events","html_url":"https://github.com/xemul/criu/issues/157","id":154802522,"number":157,"title":"Suspicious implicit sign extension: \"hdr->e_shstrndx\" with type \"unsigned short\" ","user":{"login":"avagin","id":1049830,"avatar_url":"https://avatars.githubusercontent.com/u/1049830?v=3","gravatar_id":"","url":"https://api.github.com/users/avagin","html_url":"https://github.com/avagin","followers_url":"https://api.github.com/users/avagin/followers","following_url":"https://api.github.com/users/avagin/following{/other_user}","gists_url":"https://api.github.com/users/avagin/gists{/gist_id}","starred_url":"https://api.github.com/users/avagin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avagin/subscriptions","organizations_url":"https://api.github.com/users/avagin/orgs","repos_url":"https://api.github.com/users/avagin/repos","events_url":"https://api.github.com/users/avagin/events{/privacy}","received_events_url":"https://api.github.com/users/avagin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-13T21:19:46Z","updated_at":"2016-05-13T21:19:46Z","closed_at":null,"body":"*** CID 161319:    (SIGN_EXTENSION)\r\n/compel/handle-elf-32.c: 111 in get_strings_section()\r\n105             }\r\n106\r\n107             /*\r\n108              * strings section header's offset in section headers table is\r\n109              * (size of section header * index of string section header)\r\n110              */\r\n>>>     CID 161319:    (SIGN_EXTENSION)\r\n>>>     Suspicious implicit sign extension: \"hdr->e_shstrndx\" with type \"unsigned short\" (16 bits, unsigned) is promoted in \"hdr->e_shentsize * hdr->e_shstrndx\" to type \"int\" (32 bits, signed), then sign-extended to type \"unsigned long\" (64 bits, unsigned).  If \"hdr->e_shentsize * hdr->e_shstrndx\" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.\r\n111             addr = sec_table + hdr->e_shentsize * hdr->e_shstrndx;\r\n112             if (__ptr_struct_oob(addr, sizeof(Shdr_t),\r\n113                             sec_table, sec_table + sec_table_size)) {\r\n114                     pr_err(\"String section header @%#zx is out of [%#zx, %#zx)\\n\",\r\n115                             addr, sec_table, sec_table + sec_table_size);\r\n116                     return NULL;\r\n/compel/handle-elf.c: 111 in get_strings_section()\r\n105             }\r\n106\r\n107             /*\r\n108              * strings section header's offset in section headers table is\r\n109              * (size of section header * index of string section header)\r\n110              */\r\n>>>     CID 161319:    (SIGN_EXTENSION)\r\n>>>     Suspicious implicit sign extension: \"hdr->e_shstrndx\" with type \"unsigned short\" (16 bits, unsigned) is promoted in \"hdr->e_shentsize * hdr->e_shstrndx\" to type \"int\" (32 bits, signed), then sign-extended to type \"unsigned long\" (64 bits, unsigned).  If \"hdr->e_shentsize * hdr->e_shstrndx\" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1.\r\n111             addr = sec_table + hdr->e_shentsize * hdr->e_shstrndx;\r\n112             if (__ptr_struct_oob(addr, sizeof(Shdr_t),\r\n113                             sec_table, sec_table + sec_table_size)) {\r\n114                     pr_err(\"String section header @%#zx is out of [%#zx, %#zx)\\n\",\r\n115                             addr, sec_table, sec_table + sec_table_size);\r\n116                     return NULL;"}}