return false;
aDieInfo->length = bfd_get_32 (abfd, xptr);
xptr += 4;
- if (aDieInfo->length == 0
- || this_die + aDieInfo->length > aDiePtrEnd)
+ if (aDieInfo->length <= 4
+ || (size_t) (aDiePtrEnd - this_die) < aDieInfo->length)
return false;
aDiePtrEnd = this_die + aDieInfo->length;
if (aDieInfo->length < 6)
if (xptr + 2 <= aDiePtrEnd)
{
block_len = bfd_get_16 (abfd, xptr);
- if ((unsigned int) (aDiePtrEnd - xptr) < block_len)
+ if ((size_t) (aDiePtrEnd - xptr) < block_len)
return false;
xptr += block_len;
}
if (xptr + 4 <= aDiePtrEnd)
{
block_len = bfd_get_32 (abfd, xptr);
- if ((unsigned int) (aDiePtrEnd - xptr) < block_len)
+ if ((size_t) (aDiePtrEnd - xptr) < block_len)
return false;
xptr += block_len;
}