mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-06-22 01:41:55 +08:00
fix(stringx): reject start > stop in Substr to prevent slice panic (#5616)
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
This commit is contained in:
@@ -356,6 +356,13 @@ func TestSubstr(t *testing.T) {
|
||||
err: ErrInvalidStopPosition,
|
||||
expect: "",
|
||||
},
|
||||
{
|
||||
input: "hello",
|
||||
start: 3,
|
||||
stop: 2,
|
||||
err: ErrInvalidStopPosition,
|
||||
expect: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, each := range cases {
|
||||
|
||||
Reference in New Issue
Block a user