quic_record_append: return correct code #8358
Open
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.
0-return from quic_record_append is an error.
quic_record_complete(qr) || len == 0
is not an error condition. We should return as normal on success.The issue is that passing in buffers with length 1 then 3 causes
qr_length
(inquic_record_make
) to return 0. Then whenquic_record_append
gets called thelen
gets consumed by the firstif
andlen == 0
is true. This causes the error return which is not correct behaviour.Reported in #8156. Reproducing is a bit tricky. I couldn't get the docker to work.
First setup ngtcp2 as described in https://github.com/ngtcp2/ngtcp2/pkgs/container/ngtcp2-interop. The Relevant steps are (I tested with master/main branches of all libs):
Download and unzip https://github.com/user-attachments/files/17621329/failing.pcap.zip
From the ngtcp2 dir:
Then run the following python script (
failing.pcap
has to be available in the running dir) (probably needs to be run assudo
):Then observe the log line:
You can also use
gdb
and place a break inside the following section inwolfssl/src/quic.c
.