Skip to content

Index out of bounds on FeatureManager.GetFeatureNames when flags array is empty #39

Description

@esotuvaka

This code:

func (fm *FeatureManager) GetFeatureNames() []string {
	flags, err := fm.featureProvider.GetFeatureFlags()
	if err != nil {
		log.Printf("failed to get feature flag names: %v", err)
		return nil
	}

	res := make([]string, 0, len(flags))
	for i, flag := range flags {
		res[i] = flag.ID
	}

	return res
}

Will index OOB if flags returns an empty []string. This causes a panic in client code that calls into this SDK

Activity

  1. linglingye001 commented on Apr 14, 2026

    @linglingye001
    Member

    Hi Eric (@esotuvaka) Sorry for the late response. The bug has been fixed in #43, we will release it soon.

  2. linglingye001 commented on Apr 21, 2026

    @linglingye001
    Member

    The bug fix was released in v1.1.2, here's release notes

  3. esotuvaka commented on Apr 21, 2026

    @esotuvaka
    Author

    Awesome, thank you. I appreciate all the effort you've put into this repo and others. You're doing great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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