[Rpm-maint] [rpm-software-management/rpm] Use int64_t for lengths (#1492)
Demi Marie Obenour
notifications at github.com
Fri Feb 19 08:53:45 UTC 2021
@DemiMarie commented on this pull request.
> @@ -467,15 +468,14 @@ static int dataLength(rpm_tagtype_t type, rpm_constdata_t p, rpm_count_t count,
break;
default:
- if (typeSizes[type] == -1)
- return -1;
- length = typeSizes[(type & 0xf)] * count;
- if (length < 0 || (se && (s + length) > se))
+ /* this won’t overflow, since ‘long_count’ is 64-bit */
+ length = typeSizes[type] * long_count;
+ if (length <= 0 || (se && length > se - s))
I went with making `typeSizes` 64-bit, which will help prevent similar problems elsewhere.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1492#discussion_r579012812
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210219/92de9708/attachment.html>
More information about the Rpm-maint
mailing list