alobbs/libhpack — pull request #17 by Akrog (2014-02-27 13:04:56+00:00)
Title: Adds test to huffman_test.c to confirm issue #15

https://github.com/alobbs/libhpack/issues/15

Current huffman decoding return false accept in some cases. The newly
added test in huffman_test.c confirms that the error exists using the
following stream:
- Hex data: 0xFE 0xBF 0xFF 0xFF 0xF7
- Binary data: 11111110|10111111|11111111|11111111|11110111

Looking at the [Huffman codes in the draft](http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-06#appendix-C)
we can see that the decoding of that stream is as follows:
- 11111110|10 --> '*' ( 42)
- 11111111|11111111|11111111|110 --> (162)
- 110 --> Partial stream

So we can see that we cannot consider that to be accepted since we are
in the middle of the decoding of those 3 last bytes.

According to the table that sequence leads to an accept flag:
/\* 255 \*/ {{3,0x2,162},{4,0x2,162},{8,0x2,162},{11,0x2,162},
{16,0x2,162},{21,0x2,162},{29,0x2,162},**{37,0x3,162}**,{3,0x2,163},
{4,0x2,163},{8,0x2,163},{11,0x2,163},{16,0x2,163},{21,0x2,163},
{29,0x2,163},{37,0x3,163},},
};

Which is impossible and also inconsistent with the rest of the table.