diff options
author | Ting-Wei Lan <tingwei.lan@cobinhood.com> | 2019-03-26 15:37:38 +0800 |
---|---|---|
committer | lantw44 <lantw44@gmail.com> | 2019-03-29 18:40:42 +0800 |
commit | c0bd8666ba48082830ccdf61259f21fbbd216ebb (patch) | |
tree | 5174a788aef38da15a19622e12e3d913d444fee5 | |
parent | 990e203b6f09dfab1b4f4083d678d088ae6a5176 (diff) | |
download | dexon-c0bd8666ba48082830ccdf61259f21fbbd216ebb.tar.gz dexon-c0bd8666ba48082830ccdf61259f21fbbd216ebb.tar.zst dexon-c0bd8666ba48082830ccdf61259f21fbbd216ebb.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 } |