forked from Imagelibrary/rtems
libdl: Fix possible 16-bit overflow (Coverity 1255339) refs #2192.
On a 16-bit target the section value could result in a sign-extension overflow.
This commit is contained in:
@@ -639,7 +639,7 @@ rtems_rtl_elf_parse_sections (rtems_rtl_obj_t* obj, int fd, Elf_Ehdr* ehdr)
|
|||||||
{
|
{
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
off = obj->ooffset + ehdr->e_shoff + (section * ehdr->e_shentsize);
|
off = obj->ooffset + ehdr->e_shoff + (((uint32_t) section) * ehdr->e_shentsize);
|
||||||
|
|
||||||
if (!rtems_rtl_obj_cache_read_byval (sects, fd, off, &shdr, sizeof (shdr)))
|
if (!rtems_rtl_obj_cache_read_byval (sects, fd, off, &shdr, sizeof (shdr)))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user