From f31b13bfcdb4bc73eb66e3fe99282f9240405761 Mon Sep 17 00:00:00 2001 From: Cockos Inc Date: Fri, 10 Jan 2025 16:10:02 -0500 Subject: [PATCH] + JSFX/ReaScript/Video: fix potential incorrect memory read when parsing tan(x,y) eel2: fix potential memory error when looking for tan(x,y) -- from 82943133 --- WDL/eel2/nseel-compiler.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/WDL/eel2/nseel-compiler.c b/WDL/eel2/nseel-compiler.c index ccae06b5..d6894632 100644 --- a/WDL/eel2/nseel-compiler.c +++ b/WDL/eel2/nseel-compiler.c @@ -666,7 +666,11 @@ functionType *nseel_getFunctionByName(compileContext *ctx, const char *name, int NSEEL_HOSTSTUB_LeaveMutex(); } idx=functable_lowerbound(fnTable1,fn1size,name,&match); - if (match) return fnTable1+idx; + if (match) + { + if (mchk) *mchk = 0; + return fnTable1+idx; + } if ((!ctx || !(ctx->current_compile_flags&NSEEL_CODE_COMPILE_FLAG_ONLY_BUILTIN_FUNCTIONS)) && tab->list) { @@ -1341,7 +1345,7 @@ opcodeRec *nseel_resolve_named_symbol(compileContext *ctx, opcodeRec *rec, int p } if (match_parmcnt_pos < 3) match_parmcnt[match_parmcnt_pos++] = (f->nParams&FUNCTIONTYPE_PARAMETERCOUNTMASK); f++; - if (stricmp(f->name,sname)) break; + if (chkamt < 0 || stricmp(f->name,sname)) break; } } if (ctx->last_error_string[0]) lstrcatn(ctx->last_error_string, ", ", sizeof(ctx->last_error_string)); @@ -5702,7 +5706,7 @@ opcodeRec *nseel_createFunctionByName(compileContext *ctx, const char *name, int return o; } f++; - if (stricmp(f->name,name)) break; + if (chkamt < 0 || stricmp(f->name,name)) break; } return NULL; } -- 2.11.4.GIT