[PATCH] fix: ensure libdpkg fsys-hash is reset on reuse.
| Newsgroups | gmane.linux.debian.devel.dpkg.general |
|---|---|
| Message-ID | <[email protected]> |
<style>
.deepin-mail-1758607772655-084ce7f76e {
color:#000000;
font-size:14px;
font-family:Noto Sans CJK SC;
line-height: 1.4;
}
.deepin-mail-1758607772655-084ce7f76e p {
margin-block-start: 0;
margin-block-end: 0;
-webkit-margin-before: 0;
-webkit-margin-after: 0;
}
.deepin-mail-1758607772655-084ce7f76e table {
margin-bottom: 5px;
}
.deepin-mail-1758607772655-084ce7f76e img {
margin: 0 3px;
}
.deepin-mail-1758607772655-084ce7f76e hr.mail-sign-halving-line {
position: relative;
width: 100%;
margin: 5px auto 5px 0;
padding: 0 0 20px 0;
border: none;
}
.deepin-mail-1758607772655-084ce7f76e hr.mail-sign-halving-line::before {
content: "";
width: 200px;
height: 1px;
background-color: #d9d9d9;
position: absolute;
top: calc(50% - 1px);
left: 0;
z-index: 1;
}
.deepin-mail-1758607772655-084ce7f76e li::marker {
color: #000;
}
#sign .m-account, .tinymce-editor-sign .m-account{
display: inline-block;
color: #0000ee;
}
</style>
<div class="deepin-mail-1758607772655-084ce7f76e"><p>libdpkg consuming a large amount of cache memory, so I would<br> release it after use. However, upon re-initializing it for<br> the next use, it would crash.<br><br> when libdpkg is reused, its internal hash table's bin array<br> (fsys_namenode *bins[BINS]) was not being properly reset.<br> This caused fsys_hash_find_node to crash by dereferencing<br> stale pointers from a previous operation.</p>
<p> </p>
<div id="sign">
<p style="display: inline-block; margin-top: 10px; color: #0000ee;"><span class="sign-click">[email protected]</span></p>
</div></div>
0001-fix-ensure-libdpkg-fsys-hash-is-reset-on-reuse.patch
(application/mbox, 1.3 KB)
From 9d0bdcccf579107b1df0dceddc27c64a4a49f204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BA=9A?= <[email protected]> Date: Tue, 23 Sep 2025 13:53:09 +0800 Subject: [PATCH] fix: ensure libdpkg fsys-hash is reset on reuse. libdpkg consuming a large amount of cache memory, so I would release it after use. However, upon re-initializing it for the next use, it would crash. when libdpkg is reused, its internal hash table's bin array (fsys_namenode *bins[BINS]) was not being properly reset. This caused fsys_hash_find_node to crash by dereferencing stale pointers from a previous operation. --- lib/dpkg/dbmodify.c | 1 + lib/dpkg/fsys-hash.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/dpkg/dbmodify.c b/lib/dpkg/dbmodify.c index 139dc32c4..7de8c6f3b 100644 --- a/lib/dpkg/dbmodify.c +++ b/lib/dpkg/dbmodify.c @@ -423,6 +423,7 @@ void modstatdb_shutdown(void) { } pkg_hash_reset(); + fsys_hash_reset(); modstatdb_done(); } diff --git a/lib/dpkg/fsys-hash.c b/lib/dpkg/fsys-hash.c index 42cb956de..570dd9eb3 100644 --- a/lib/dpkg/fsys-hash.c +++ b/lib/dpkg/fsys-hash.c @@ -59,6 +59,9 @@ fsys_hash_init(void) void fsys_hash_reset(void) { + if (nfiles == 0) + return; + memset(bins, 0, sizeof(bins)); nfiles = 0; } -- 2.20.1