Repository navigation
Conversation
somaz94
added a commit
to somaz94/somaz94
that referenced
this pull request
Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Loading a config through the v2jsonpb loader panics with a nil pointer dereference as soon as it meets a field name the message does not define. When the config comes from stdin, v2ray tries every loader in turn and v2jsonpb panics before the others get a chance, so
echo '{ "status": {} }' | v2ray testcrashes instead of falling through to the next format. This is what #3598 reports.ByJSONNameandByTextNameonV2JsonProtobufFollowerFieldswrap the inner lookup inV2JsonProtobufFollowerFieldDescriptoreven when it finds nothing, so protojson gets a non-nil descriptor holding nil. protojson only reports an unknown field, and only retries with the proto field name, when the lookup returns nil, so it callsfd.Number()on the empty wrapper instead. Snake case keys such asreceiver_settingshit the same panic for the same reason.Both methods now return nil when the inner lookup finds nothing. The new
TestLoadFieldNamescovers a JSON name, a proto name, and an unknown field at the top level, in a list element and inside an Any value.Validation: the new test panics without the change and passes with it, on go1.27.1 and go1.26.1. The stdin command above panicked before and prints
Configuration OK.after. golangci-lint with.github/linters/.golangci.ymlreports 0 issues, andgo mod tidyleaves go.mod and go.sum unchanged.go test ./...passes exceptTestServiceSubscribeRoutingStatsinapp/router/command, which failed once in the full run, passes 10 out of 10 runs on its own with and without this change, and does not depend on v2jsonpb.Fixes #3598