This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e757ba8926bd4a2d24ee9b94fc9b79cdb105de73
Author: ligd <[email protected]>
AuthorDate: Mon Sep 8 12:28:43 2025 +0800

    backtrace: fix refs overflow in 16bits
    
    The reference count of a backtrace record was a uint16_t, so a
    backtrace shared by more than 65535 holders, e.g. one call site that
    allocates many blocks, wrapped the count, and the record was freed
    while still in use.  Use uint32_t for the reference count and the
    depth.
    
    Signed-off-by: ligd <[email protected]>
---
 libs/libc/misc/lib_backtrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libs/libc/misc/lib_backtrace.c b/libs/libc/misc/lib_backtrace.c
index 82737bcec40..89094a7f8f6 100644
--- a/libs/libc/misc/lib_backtrace.c
+++ b/libs/libc/misc/lib_backtrace.c
@@ -65,8 +65,8 @@ struct backtrace_entry_s
   };
 
   FAR void *next;  /* Next index in the hash chain */
-  uint16_t  depth; /* Depth of the backtrace */
-  uint16_t  ref;   /* Count of the backtrace */
+  uint32_t  depth; /* Depth of the backtrace */
+  uint32_t  ref;   /* Count of the backtrace */
 };
 
 struct backtrace_pool_s

Reply via email to