netty / netty-incubator-codec-quic

Apache License 2.0
300 stars 70 forks source link

`QuicTokenHandler` receives buffers of different endianness #731

Closed makkarpov closed 3 months ago

makkarpov commented 3 months ago

Version: ~0.0.64.Final~ 0.0.65.Final

QuicTokenHandler receives swapped byte buffer in writeToken, but a regular buffer in validateToken.

This could give you a lot of debugging time figuring out why none of the readInt, writeInt and similar functions works correctly.

normanmaurer commented 3 months ago

@makkarpov I think we should most likely swap it before we call writeToken. Do you want to do a PR ?

makkarpov commented 3 months ago

Sure, I can do the PR.

You mean wrap in the SwappedByteBuf for the second time? It should not be a big deal in performance terms (since tokens are short), but construction like SwappedByteBuf(SwappedByteBuf(x)) look awkward. Shouldn't we just remove allocateNativeOrder from the allocation of mintTokenBuffer? Byte order of this buffer does not seem to be relevant anywhere.

normanmaurer commented 3 months ago

Sounds good