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

fix: when 'data' is nil, panic occurs #1524

Open
wants to merge 2 commits into
base: Alpha
Choose a base branch
from
Open

Conversation

Luoxin
Copy link

@Luoxin Luoxin commented Sep 20, 2024

No description provided.

@Skyxim
Copy link
Collaborator

Skyxim commented Sep 20, 2024

if !ok || value == nil {

It has been ensured that the decode input parameter data is not nil. Is there a clear location that causes panic?
Could you add a unit test?

@Luoxin
Copy link
Author

Luoxin commented Sep 21, 2024

name, val.Type(), dataVal.Type(),

The location where the panic occurred is /common/structure/structure.go:251. The error reported at that time was because dataVal was Zero, which caused the dataValue.Type() call in the default branch to throw panic. The original error message is

panic: reflect: call of reflect.Value.Type on zero Value

After searching, it was found that the value of h2-opts.path in the configuration was set to nil. The original source of the configuration is not yet known. Related unit tests have been added.

@Skyxim
Copy link
Collaborator

Skyxim commented Sep 22, 2024

After searching, it was found that the value of h2-opts.path in the configuration was set to nil.

It seems that the value in the map is not checked. Just add the check here.

if err := d.decode(fieldName, k.Interface(), currentKey); err != 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

Successfully merging this pull request may close these issues.

2 participants