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

Some fixes about Hysteria 2 #3147

Merged
merged 4 commits into from
Sep 8, 2024
Merged

Some fixes about Hysteria 2 #3147

merged 4 commits into from
Sep 8, 2024

Conversation

dyhkwong
Copy link
Contributor

@dyhkwong dyhkwong commented Sep 8, 2024

}
size := QuicLen(addressLen) + addressLen + QuicLen(paddingLen) + paddingLen

Check failure

Code scanning / CodeQL

Size computation for allocation may overflow High

This operation, which is used in an
allocation
, involves a
potentially large value
and might overflow.
Copy link
Contributor Author

@dyhkwong dyhkwong Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a corrent complaint. Maximum QuicLen is 8, addressLen is validated not to overflow (<= 2048), and paddingLen has a maximum length (511).

Copy link
Contributor

@xiaokangwang xiaokangwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there still future work for hysteria2, but I am happy to merge it as is.

This pull request is ready to be merged. Thanks for your contribution.

case packetaddr.PacketAddrType_Packet:
packetAddrDispatcherFactory := udp.NewPacketAddrDispatcherCreator(ctx)
udpDispatcherConstructor = packetAddrDispatcherFactory.NewPacketAddrDispatcher
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to correctly process packet addr fullcone traffic, the incoming stream should be decoded: https://github.com/v2fly/v2ray-core/blob/master/proxy/trojan/client.go#L90 . I can merge this now without requiring additional changes, but another merge request to support packetaddr is welcomed.

padding := make([]byte, paddingLen)
for i := range padding {
padding[i] = paddingChars[rand.Intn(len(paddingChars))]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the padding have to be filled with something, although it is always a good habit to initialize a buffer. It might be changed in the future, but let's keep it that way for now.

@xiaokangwang xiaokangwang merged commit 84adf2b into v2fly:master Sep 8, 2024
37 of 39 checks passed
@dyhkwong dyhkwong deleted the hy2 branch September 8, 2024 18:17
@dyhkwong dyhkwong restored the hy2 branch September 8, 2024 18:45
@dyhkwong dyhkwong deleted the hy2 branch September 8, 2024 18:45
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