diff options
author | xuri <xuri.me@gmail.com> | 2020-05-29 00:26:40 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2020-05-29 00:26:40 +0800 |
commit | 2ae631376b95ff0a59ea18c2c0befcd50135b020 (patch) | |
tree | c3542c127aed38cac104c513047327d6316b91d1 /lib.go | |
parent | c168233e70db8f220bd07d9d6d277ae9e2a4a73f (diff) |
add limits for total columns, row and filename length
Diffstat (limited to 'lib.go')
-rw-r--r-- | lib.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -135,6 +135,9 @@ func ColumnNameToNumber(name string) (int, error) { } multi *= 26 } + if col > TotalColumns { + return -1, fmt.Errorf("column number exceeds maximum limit") + } return col, nil } @@ -172,7 +175,9 @@ func CellNameToCoordinates(cell string) (int, int, error) { if err != nil { return -1, -1, fmt.Errorf(msg, cell, err) } - + if row > TotalRows { + return -1, -1, fmt.Errorf("row number exceeds maximum limit") + } col, err := ColumnNameToNumber(colname) return col, row, err } |