From 2fccab156cfa768fe571527f40c0c9171b25b4cc Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Sat, 6 Jan 2024 11:20:20 +0100 Subject: added a comment for non-initialized warning in Valgrind (github issue #153) --- lib/quickjs/quickjs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/quickjs/quickjs.c') diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c index 40beb2dc..78593161 100644 --- a/lib/quickjs/quickjs.c +++ b/lib/quickjs/quickjs.c @@ -8000,6 +8000,16 @@ static JSValue JS_GetPropertyValue(JSContext *ctx, JSValueConst this_obj, /* fast path for array access */ p = JS_VALUE_GET_OBJ(this_obj); idx = JS_VALUE_GET_INT(prop); + /* Note: this code works even if 'p->u.array.count' is not + initialized. There are two cases: + - 'p' is an array-like object. 'p->u.array.count' is + initialized so the slow_path is taken when the index is + out of bounds. + - 'p' is not an array-like object. 'p->u.array.count' has + any value and potentially not initialized. In all the cases + (idx >= len or idx < len) the slow path is taken as + expected. + */ len = (uint32_t)p->u.array.count; if (unlikely(idx >= len)) goto slow_path; -- cgit 1.4.1-2-gfad0 rtik/mu/about/?h=main'>about summary refs log blame commit diff stats
path: root/arc/.traces/convert-names-nil
blob: e62c07e160d8be70c4dd5b50c5bda016947c481a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18