[cifs-protocol] [EXTERNAL] RE: [REG:120060621000848] [MS-XCA] L77+Huffman negative huffman symbol update

Aurélien Aptel aaptel at suse.com
Mon Jun 22 16:59:02 UTC 2020

Hi Jeff,

I've read and reread this and MS-XCA multiple times over but I still
cannot understand :(

Jeff McCashland <jeffm at microsoft.com> writes:
> We have some explanation of the pseudocode in question:
> A negative HuffmanSymbol indicates that the size of the value exceeds the value of the table (is > 64k). The location for the actual value is based of the decoded value:
>         Each 16-bit entry in the table/tree follows this protocol:
>           If the high bit is zero, the table/tree value is
>           (decoded symbol) * 16 + (symbol bit length)
>           If the high bit is one, the table/tree value is:
>           -(index of tree node to decode remaining bits)
> The high bit being 1 is what makes the number negative.

The table has 2^15 entries. We know this from:

"The decoding table will have 2^15 entries because 15 is the maximum bit
length permitted by the Xpress Compression Algorithm for a Huffman

The decoding table construction code indicates the same thing:

  If CurrentTableEntry does not equal 2^15
	 The compressed data is not valid. Return with error.

Each entry index range from 0 to 2^15-1 (15 bits). *All* these indexes
have the highest bit to zero (2^15-1 = 0111 1111 1111 1111). There
cannot be any negative indexes.

Each entry value is in the range 0-511 ("For Symbol = 0 to 511"). There
cannot be any negative values.

Could you double-check if the table construction pseudocode (not the
final decoding) is up to date? It really seems like it is off.

Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)

More information about the cifs-protocol mailing list