Skip to content

In case of inproper argument passing, the tool will panic #231

@filipecosta90

Description

@filipecosta90

Given on line 94, there is no check for the slice length:

globalProps.Set(seps[0], seps[1])

in case of improper argument passing:

Example:

./bin/go-ycsb load redis  -p recordcount=10000 -p threadcount 4

the tool will panic:

$ ./bin/go-ycsb load redis  -p recordcount=10000 -p threadcount 4
panic: runtime error: index out of range [1] with length 1

goroutine 1 [running]:
main.initialGlobal({0x7ffe6908663f, 0x5}, 0xc0007bfb00)
        /home/fco/redislabs/go-ycsb/cmd/go-ycsb/main.go:94 +0x61b
main.runClientCommandFunc(0x795ee0?, {0xc0005e82a0?, 0xc0007bfcd0?, 0x0?}, 0x0?)
        /home/fco/redislabs/go-ycsb/cmd/go-ycsb/client.go:30 +0x90
main.runLoadCommandFunc(0xc000579b80?, {0xc0005e82a0?, 0x6?, 0x6?})
        /home/fco/redislabs/go-ycsb/cmd/go-ycsb/client.go:66 +0x25
github.com/spf13/cobra.(*Command).execute(0xc000579b80, {0xc0005e8240, 0x6, 0x6})
        /home/fco/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x663
github.com/spf13/cobra.(*Command).ExecuteC(0xc000579340)
        /home/fco/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x39c
github.com/spf13/cobra.(*Command).Execute(...)
        /home/fco/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
        /home/fco/redislabs/go-ycsb/cmd/go-ycsb/main.go:172 +0x22c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions