diff options
author | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-03-26 15:37:38 +0800 |
---|---|---|
committer | Jhih-Ming Huang <jm.huang@cobinhood.com> | 2019-05-06 10:44:04 +0800 |
commit | fc018ce069cefde728b8b579d802b8fa1c008af6 (patch) | |
tree | a1d7660a5ad966f2ee45ae26b2243f08d8f87732 | |
parent | b72d7b04bba7ce3a3117b61b15cad3c40e19f1c0 (diff) | |
download | dexon-fc018ce069cefde728b8b579d802b8fa1c008af6.tar.gz dexon-fc018ce069cefde728b8b579d802b8fa1c008af6.tar.zst dexon-fc018ce069cefde728b8b579d802b8fa1c008af6.zip |
core: vm: sqlvm: schema: unsigned integers can never be negative
-rw-r--r-- | core/vm/sqlvm/schema/schema.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/vm/sqlvm/schema/schema.go b/core/vm/sqlvm/schema/schema.go index d77cd3855..56b0be49a 100644 --- a/core/vm/sqlvm/schema/schema.go +++ b/core/vm/sqlvm/schema/schema.go @@ -123,10 +123,10 @@ func (t *Table) GetFieldType(fields []uint8) ([]ast.DataType, error) { types := make([]ast.DataType, len(fields)) columns := t.Columns for i, f := range fields { - if int(f) < 0 || int(f) >= len(columns) { + if int(f) >= len(columns) { return nil, se.ErrorCodeIndexOutOfRange } - types[i] = columns[int(fields[i])].Type + types[i] = columns[f].Type } return types, nil } |