[PATCH v7 07/11] jscript: Access the PROTREF with proper index instead of get_prop.

Gabriel Ivăncescu gabrielopcode at gmail.com
Wed Nov 24 08:10:36 CST 2021


Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---

get_prop is based on DISPID, not index. This is fragile and works right now,
but not after the value_prop is removed in next patch and DISPIDs don't
map directly to indices anymore.

 dlls/jscript/dispex.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index eba3b73..a00e36b 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -109,8 +109,12 @@ static inline BOOL is_function_prop(dispex_prop_t *prop)
 static DWORD get_flags(jsdisp_t *This, dispex_prop_t *prop)
 {
     if(prop->type == PROP_PROTREF) {
-        dispex_prop_t *parent = get_prop(This->prototype, prop->u.ref);
-        if(!parent) {
+        dispex_prop_t *parent = NULL;
+
+        if(prop->u.ref < This->prototype->prop_cnt)
+            parent = &This->prototype->props[prop->u.ref];
+
+        if(!parent || parent->type == PROP_DELETED) {
             prop->type = PROP_DELETED;
             return 0;
         }
-- 
2.31.1




More information about the wine-devel mailing list