From cccf71f117f6acd02726d8d72702bdc8cc35d86d Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Tue, 3 Nov 2015 23:38:03 +0800 Subject: Avoid incomplete data transfer. Fix loop mark stack underflowing. --- src/core/vmrunner.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/vmrunner.cpp') diff --git a/src/core/vmrunner.cpp b/src/core/vmrunner.cpp index 43fe1f5..1767cfa 100644 --- a/src/core/vmrunner.cpp +++ b/src/core/vmrunner.cpp @@ -18,11 +18,11 @@ Idata& blrScriptVM::fetchData(SPara para,bool forcerw) { case 0: if(forcerw)throw; - cret.i()=para.data.i;cret.type=0; + cret.D.d=para.data.d;cret.type=0; return cret; case 1: if(forcerw)throw; - cret.r()=para.data.r;cret.type=1; + cret.D.d=para.data.d;cret.type=1; return cret; case 2: return ir[para.data.i]; @@ -274,7 +274,7 @@ void blrScriptVM::vmRunFunction(const char *fncnym) if(fetchData(inst[cur].para1).nez()) { lpjmp[lops]=cur; - lppos[lops++]=fetchData(inst[cur].para2); + lppos[lops++]=fetchData(inst[cur].para2).i(); } else cur=fetchData(inst[cur].para2).i()+1,jmp=1; break; @@ -287,7 +287,7 @@ void blrScriptVM::vmRunFunction(const char *fncnym) cur=lppos[--lops],jmp=1; break; } - if(cur==lppos[lops-1])cur=lpjmp[--lops],jmp=1; + if(lops&&cur==lppos[lops-1])cur=lpjmp[--lops],jmp=1; if(!jmp)++cur; } } -- cgit v1.2.3