Commit 8dcb142c authored by kingwang's avatar kingwang Committed by 33cn

fixbug: errenvapi

parent fc9eec0c
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
"sync" "sync"
"sync/atomic" "sync/atomic"
"github.com/33cn/chain33/client/api"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
drivers "github.com/33cn/chain33/system/dapp" drivers "github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
...@@ -14,6 +13,8 @@ import ( ...@@ -14,6 +13,8 @@ import (
"github.com/33cn/plugin/plugin/dapp/js/types/jsproto" "github.com/33cn/plugin/plugin/dapp/js/types/jsproto"
lru "github.com/hashicorp/golang-lru" lru "github.com/hashicorp/golang-lru"
"github.com/robertkrimen/otto" "github.com/robertkrimen/otto"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
) )
var driverName = ptypes.JsX var driverName = ptypes.JsX
...@@ -115,8 +116,10 @@ func (u *js) callVM(prefix string, payload *jsproto.Call, tx *types.Transaction, ...@@ -115,8 +116,10 @@ func (u *js) callVM(prefix string, payload *jsproto.Call, tx *types.Transaction,
vm.Set("args", payload.Args) vm.Set("args", payload.Args)
callfunc := "callcode(context, f, args, loglist)" callfunc := "callcode(context, f, args, loglist)"
jsvalue, err := vm.Run(callfunc) jsvalue, err := vm.Run(callfunc)
//除非你知道怎么做,不要返回这样的操作,这会引起整个区块执行失败,从而引起严重的安全问题。
//要保证不能人工的创造这样的条件,也就是调用接口的输入,不能用户可以任意修改的。
if u.GetExecutorAPI().IsErr() { if u.GetExecutorAPI().IsErr() {
return nil, api.ErrAPIEnv return nil, status.New(codes.Aborted, "jsvm operation is abort").Err()
} }
if err != nil { if err != nil {
return nil, err return nil, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment