diff --git a/avoid-memleak-exceed-int-range-when-using-heap-check.patch b/avoid-memleak-exceed-int-range-when-using-heap-check.patch new file mode 100644 index 0000000000000000000000000000000000000000..fceb4d3c0b48fc0eeba96bef8419471803d3eca0 --- /dev/null +++ b/avoid-memleak-exceed-int-range-when-using-heap-check.patch @@ -0,0 +1,36 @@ +From ea47513a8f8b1b96e0c0e9d776503e2245e45efd Mon Sep 17 00:00:00 2001 +From: zhangyiru <877061968@qq.com> +Date: Fri, 15 Oct 2021 18:21:36 -0400 +Subject: [PATCH] avoid memleak exceed int range when using heap-checker + +[alkondratenko@gmail.com] format size_t with %zu +Signed-off-by: Aliaksey Kandratsenka +--- + src/heap-profile-table.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/heap-profile-table.cc b/src/heap-profile-table.cc +index ec2e047..3fe6d93 100644 +--- a/src/heap-profile-table.cc ++++ b/src/heap-profile-table.cc +@@ -517,7 +517,7 @@ HeapProfileTable::Snapshot* HeapProfileTable::NonLiveSnapshot( + // Information kept per unique bucket seen + struct HeapProfileTable::Snapshot::Entry { + int count; +- int bytes; ++ size_t bytes; + Bucket* bucket; + Entry() : count(0), bytes(0) { } + +@@ -592,7 +592,7 @@ void HeapProfileTable::Snapshot::ReportLeaks(const char* checker_name, + for (int i = 0; i < to_report; i++) { + const Entry& e = entries[i]; + base::RawPrinter printer(buffer, kBufSize); +- printer.Printf("Leak of %d bytes in %d objects allocated from:\n", ++ printer.Printf("Leak of %zu bytes in %d objects allocated from:\n", + e.bytes, e.count); + for (int j = 0; j < e.bucket->depth; j++) { + const void* pc = e.bucket->stack[j]; +-- +2.28.0 + diff --git a/gperftools.spec b/gperftools.spec index 7fd00450a20912d26fadbb754b7fa5779d4b4d30..efdc3788e17baa826d5999ad0abc40a7e739ba0d 100644 --- a/gperftools.spec +++ b/gperftools.spec @@ -1,12 +1,13 @@ Name: gperftools Version: 2.8 -Release: 1 +Release: 2 Summary: high-performance malloc and performance analysis tools License: BSD URL: https://github.com/gperftools/gperftools Source0: https://github.com/gperftools/gperftools/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz Patch9000: issue-1122-fix-bus-error-on-aarch64.patch +Patch9001: avoid-memleak-exceed-int-range-when-using-heap-check.patch BuildRequires: autoconf automake gcc-c++ gdb BuildRequires: libtool libunwind-devel perl-generators @@ -98,6 +99,9 @@ make %{_mandir}/man1/*.1.gz %changelog +* Thu Dec 7 2023 nicunshu - 2.8-2 +- backport a patch to avoid memleak exceeding int range in heap check + * Wed Aug 26 2020 xinghe - 2.8-1 - update to 2.8