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/laser.hpp | 4 ++++ src/core/vmrunner.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 src/core/laser.hpp (limited to 'src') diff --git a/src/core/laser.hpp b/src/core/laser.hpp new file mode 100644 index 0000000..2fac21c --- /dev/null +++ b/src/core/laser.hpp @@ -0,0 +1,4 @@ +#ifndef LASER_H +#define LASER_H + +#endif // LASER_H 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