From 401101f9c8077911929d3f2b60a37098460a5d89 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 24 Mar 2022 23:59:54 +0000 Subject: gentoo resync : 25.03.2022 --- dev-libs/tre/files/tre-issue55-part1.patch | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dev-libs/tre/files/tre-issue55-part1.patch (limited to 'dev-libs/tre/files/tre-issue55-part1.patch') diff --git a/dev-libs/tre/files/tre-issue55-part1.patch b/dev-libs/tre/files/tre-issue55-part1.patch new file mode 100644 index 000000000000..8e12cf683030 --- /dev/null +++ b/dev-libs/tre/files/tre-issue55-part1.patch @@ -0,0 +1,28 @@ +--- a/lib/tre-parse.c ++++ b/lib/tre-parse.c +@@ -582,16 +582,23 @@ + tre_parse_int(const tre_char_t **regex, const tre_char_t *regex_end) + { + int num = -1; ++ int overflow = 0; + const tre_char_t *r = *regex; + while (r < regex_end && *r >= L'0' && *r <= L'9') + { + if (num < 0) + num = 0; +- num = num * 10 + *r - L'0'; ++ if (num <= (INT_MAX - 9) / 10) { ++ num = num * 10 + *r - L'0'; ++ } else { ++ /* This digit could cause an integer overflow. We do not return ++ * directly; instead, consume all remaining digits. */ ++ overflow = 1; ++ } + r++; + } + *regex = r; +- return num; ++ return overflow ? -1 : num; + } + + -- cgit v1.2.3