[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1052661: marked as done (drkonqi: drop deallocation size mismatch to support hardened_malloc)



Your message dated Sat, 28 Oct 2023 15:04:47 +0200
with message-id <CAJ2a_Df3rcsJ8N9VJEU7BTbO6NgS2koC4=_0vGgsv8KFE7zKZA@mail.gmail.com>
and subject line Re: drkonqi: drop deallocation size mismatch to support hardened_malloc
has caused the Debian Bug report #1052661,
regarding drkonqi: drop deallocation size mismatch to support hardened_malloc
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
1052661: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052661
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: drkonqi
Version: 5.27.8-1
Severity: important
Tags: patch


Currently drkonqi crashes while running with hardened_malloc[1], due
to a deallocation size mismatch.
The memory returned by sd_journal_get_cursor(3) is free'd via
std::default_delete<char>::operator() instead of free(3).
Please consider applying the attached patch.


[1]: https://github.com/GrapheneOS/hardened_malloc/


diff -Nru orig/drkonqi-5.27.8/src/coredump/memory.h
deb/drkonqi-5.27.8/src/coredump/memory.h
--- orig/drkonqi-5.27.8/src/coredump/memory.h   2023-09-12
12:30:22.000000000 +0200
+++ deb/drkonqi-5.27.8/src/coredump/memory.h    2023-09-25
21:53:02.571084346 +0200
@@ -19,11 +19,11 @@
};
} // namespace std

-template<typename T>
+template<typename T, typename U = std::default_delete<T>>
struct Expected {
    const int ret; // return value of call
    const int error; // errno immediately after the call
-    std::unique_ptr<T> value; // the newly owned object (may be null)
+    std::unique_ptr<T, U> value; // the newly owned object (may be null)
};

// Wrapper around C double pointer API of which we must take ownership.
@@ -38,9 +38,9 @@

// Same as owning_ptr_call but for (sd_journal *, foo **, ...) API
template<typename T, typename Func, typename... Args>
-Expected<T> contextual_owning_ptr_call(Func func, sd_journal
*context, Args &&...args)
+Expected<T, decltype(::free)*> contextual_owning_ptr_call(Func func,
sd_journal *context, Args &&...args)
{
    T *raw = nullptr;
    const int ret = func(context, &raw, std::forward<Args>(args)...);
-    return {ret, errno, std::unique_ptr<T>(raw)};
+    return {ret, errno, std::unique_ptr<T, decltype(::free)*>(raw, ::free)};
}

--- End Message ---
--- Begin Message ---
Version: 5.27.9-1

--- End Message ---

Reply to: