Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic index out of range #5150

Open
vjeffrey opened this issue Jan 31, 2025 · 1 comment
Open

panic index out of range #5150

vjeffrey opened this issue Jan 31, 2025 · 1 comment

Comments

@vjeffrey
Copy link
Contributor

panic: runtime error: index out of range [0] with length 0

goroutine 10081 [running]:
runtime/debug.Stack()
	/home/runner/_work/_tool/go/1.23.4/x64/src/runtime/debug/stack.go:26 +0x5e
go.mondoo.com/cnquery/v11/providers-sdk/v1/upstream/health.ReportPanic({0x2a6b31e, 0x6}, {0x2f4cee0, 0x7}, {0x2f4cee8, 0x7}, {0x0, 0x0, 0x4731b60?})
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/providers-sdk/v1/upstream/health/errors.go:24 +0x79
panic({0x28ca900?, 0xc001272d80?})
	/home/runner/_work/_tool/go/1.23.4/x64/src/runtime/panic.go:785 +0x132
go.mondoo.com/cnquery/v11/llx.dictGetIndexV2(0x456fdf0?, 0xc0023288a0, 0xc0025569d2?, 0x2?)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/builtin_map.go:371 +0x64b
go.mondoo.com/cnquery/v11/llx.(*blockExecutor).runBoundFunction(0xc001e4dc70, 0xc0023288a0, 0xc00161e550, 0x30000000b)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/builtin.go:861 +0x108
go.mondoo.com/cnquery/v11/llx.(*blockExecutor).runFunction(0xc001e4dc70, 0xc00161e550, 0x30000000b)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/llx.go:816 +0x173
go.mondoo.com/cnquery/v11/llx.(*blockExecutor).runChunk(0xc001e4dc70, 0x256db60?, 0x30000000b)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/llx.go:833 +0x225
go.mondoo.com/cnquery/v11/llx.(*blockExecutor).runRef(0xc002760460?, 0xc0022e7530?)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/llx.go:858 +0xd9
go.mondoo.com/cnquery/v11/llx.(*blockExecutor).runChain(0xc001e4dc70, 0xc0022e7530?)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/llx.go:890 +0x9c
go.mondoo.com/cnquery/v11/llx.(*blockExecutor).triggerChain(0xc001e4dc70, 0x300000008, 0xc002328810)
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/llx.go:962 +0x365
go.mondoo.com/cnquery/v11/llx.runResourceFunction.func1({0x2560840, 0xc002328780}, {0x0, 0x0})
	/home/runner/go/pkg/mod/go.mondoo.com/cnquery/[email protected]/llx/builtin.go:819 +0x219
go.mondoo.com/cnquery/v11/providers.(*Runtime).WatchAndUpdate(0xc000a5d500, {0x2f7a268, 0xc001
@vjeffrey
Copy link
Contributor Author

seems to be related to this code:

func dictGetIndexV2(e *blockExecutor, bind *RawData, chunk *Chunk, ref uint64) (*RawData, uint64, error) {
	if bind.Value == nil {
		return &RawData{Type: bind.Type}, 0, nil
	}

	switch x := bind.Value.(type) {
	case []interface{}:
		args := chunk.Function.Args

		// TODO: all this needs to go into the compile phase
		if len(args) < 1 {
			return nil, 0, errors.New("Called [] with " + strconv.Itoa(len(args)) + " arguments, only 1 supported.")
		}
		if len(args) > 1 {
			return nil, 0, errors.New("Called [] with " + strconv.Itoa(len(args)) + " arguments, only 1 supported.")
		}
		t := types.Type(args[0].Type)
		if t != types.Int {
			return nil, 0, errors.New("Called [] with wrong type " + t.Label())
		}
		// ^^ TODO

		key := int(bytes2int(args[0].Value))
		return &RawData{
			Value: x[key],
			Type:  bind.Type,
		}, 0, nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant