From bedc0b6beb99139d6fb1e202b06fc97eb2c288b1 Mon Sep 17 00:00:00 2001 From: AirCity456 <767130900@qq.com> Date: Sun, 7 Sep 2025 03:20:49 +0800 Subject: [PATCH] fix(pikaobj): move name_buff from conditional block to function scope in the obj_saveMethodInfo function. Moved name_buff out of the inner if block so its storage duration covers all code paths. This prevents using pointers to a transient buffer that previously led to: 1. method name/hash mismatches 2. intermittent NameError on lookups 3. misleading integrity diagnostics --- src/PikaObj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PikaObj.c b/src/PikaObj.c index b35bb4587..d6d044b61 100644 --- a/src/PikaObj.c +++ b/src/PikaObj.c @@ -1191,8 +1191,8 @@ static void obj_saveMethodInfo(PikaObj* self, MethodInfo* tInfo) { .host_obj = NULL, }; char* name = tInfo->name; + char name_buff[PIKA_LINE_BUFF_SIZE / 2] = {0}; if (NULL == tInfo->name) { - char name_buff[PIKA_LINE_BUFF_SIZE / 2] = {0}; name = strGetFirstToken(name_buff, tInfo->dec, '('); } /* the first arg_value */