Fix 'LsTLVIPReachability Prefix Set Value' bug #2776
Closed
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.
Running the following command causes a panic:
./gobgp g r -a ls -j -u localhost -p 50051
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1 [recovered]
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running]:
encoding/json.(*encodeState).marshal.func1()
/usr/lib/go/src/encoding/json/encode.go:293 +0x6d
panic({0xc39d60?, 0xc00020da28?})
/usr/lib/go/src/runtime/panic.go:770 +0x132
encoding/json.(*encodeState).marshal.func1()
/usr/lib/go/src/encoding/json/encode.go:293 +0x6d
panic({0xc39d60?, 0xc00020da28?})
/usr/lib/go/src/runtime/panic.go:770 +0x132
github.com/osrg/gobgp/v3/pkg/packet/bgp.(*LsTLVIPReachability).ToIPNet(0xc0004cbda0, 0x0)
../github.com/osrg/gobgp/pkg/packet/bgp/bgp.go:7135 +0x225
github.com/osrg/gobgp/v3/pkg/packet/bgp.(*LsPrefixDescriptor).ParseTLVs(0xc00044edb8, {0xc0004cbdc0?, 0x10?, 0xc0003192b0?}, 0x0)
../github.com/osrg/gobgp/pkg/packet/bgp/bgp.go:5545 +0x93