Subject: [quicwg/base-drafts] QPACK sample encoder bug (#1455)

From: afrind <[email-masked]>
Date: Fri, 15 Jun 2018 15:04:43 -0700

```
delta = largestReference - baseIndex
sign = delta > 0 ? 0x80 : 0
encodeInteger(prefixBuffer, sign, delta, 7)
```

encodeInteger is meant to be an HPACK integer encoder, which cannot encode negative numbers.  It should be 

`encodeInteger(prefixBuffer, sign, abs(delta), 7)`

Another option is to use a more explicit conditional: 

```
if baseIndex >= largestReference:
  encodeInteger(prefixBuffer, 0, baseIndex - largestReference, 7)
else:
  encodeInteger(prefixBuffer, 0x80, largestReference  - baseIndex, 7)
```

-- 
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/1455

---

From: afrind <[email-masked]>
Date: Fri, 22 Jun 2018 18:21:11 +0000 (UTC)

Closed #1455 via #1470.

-- 
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/1455#event-1696539581