Subject: [quicwg/base-drafts] QPACK Required Insert Count decoding pseudocode does not enforce that encoding is valid (#2892)

From: Bence Béky <[email-masked]>
Date: Thu, 11 Jul 2019 17:39:53 -0700

Consider the following example:
MaxEntries = 8
TotalNumberOfInserts = 4
EncInsertCount = 1

Applying the decoder pseudocode yields ReqInsertCount = 0 without signalling an error.  However, the encoder should have encoded that as EncInsertCount = 0, therefore the decoder should signal an error according to the text: "If the decoder encounters a value of EncodedInsertCount that could not have been produced by a conformant encoder, it MUST treat this as a connection error of type HTTP_QPACK_DECOMPRESSION_FAILED."

The text is considered normative and the pseudocode is not.  To help decoder implementations be conformant, the pseudocode should be updated to signal an error in this case.  Adding the following two lines would be a correct solution:

    if ReqInsertCount == 0:
      Error

However, this introduces an extra branch.  It would be nice to find a more elegant decoding algorithm.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2892

---

From: Bence Béky <[email-masked]>
Date: Thu, 11 Jul 2019 17:51:16 -0700

Another bogus encoder output is:
MaxEntries = 8
TotalNumberOfInserts = 8
EncInsertCount = 1

Now MaxValue = 16, MaxWrapped = 16, so `if ReqInsertCount > MaxValue` branch is hit.  ReqInsertCount ends up being 0, just like above, so EncInsertCount should have been 0.  This particular case can be handled by replacing `if ReqInsertCount < FullRange` by `if ReqInsertCount <= FullRange`, but this does not fix the first test case above.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/quicwg/base-drafts/issues/2892#issuecomment-510703676