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

Jeff McCashland jeffm at microsoft.com
Tue Aug 18 17:35:56 UTC 2020


[-support]

Hi Aurélien,

We have updated the documentation for the next release:

[MS-XCA] 2.2.4 Processing (Second block of pseudocode)
	Loop until a decompression terminating condition    
	    Build the decoding table
	    CurrentPosition = 256              // start at the end of the Huffman table
	    NextBits = Read16Bits(InputBuffer + CurrentPosition)
	    CurrentPosition += 2
	    NextBits <<= 16
	    NextBits |= Read16Bits(InputBuffer + CurrentPosition)
	    CurrentPosition += 2
	    ExtraBitCount = 16
	    BlockEnd = OutputPosition + 65536
	    Loop until a block terminating condition
	        If the OutputPosition >= BlockEnd then terminate block processing
	        Next15Bits = NextBits >> (32 – 15)
	        HuffmanSymbol = DecodingTable[Next15Bits]
	        HuffmanSymbolBitLength = the bit length of HuffmanSymbol, from the table in
	        the input buffer
	        NextBits <<= HuffmanSymbolBitLength
	        ExtraBitCount -= HuffmanSymbolBitLength
	        If ExtraBitCount < 0
	            NextBits |= Read16Bits(InputBuffer + CurrentPosition) << (-ExtraBitCount)
	            ExtraBitCount += 16
	            CurrentPosition += 2
	        If HuffmanSymbol < 256
	            Output the byte value HuffmanSymbol to the output stream.
	        Else If HuffmanSymbol == 256 and
	                the entire input buffer has been read and
	                the expected decompressed size has been written to the output buffer
	            Decompression is complete.  Return with success.
	        Else
	            HuffmanSymbol = HuffmanSymbol - 256
	            MatchLength = HuffmanSymbol mod 16
	            MatchOffsetBitLength = HuffmanSymbol / 16
	            If MatchLength == 15
	                MatchLength = ReadByte(InputBuffer + CurrentPosition)
	                CurrentPosition += 1
	                If MatchLength == 255
	                    MatchLength = Read16Bits(InputBuffer + CurrentPosition)
	                    CurrentPosition += 2
	                    If MatchLength < 15
	                        The compressed data is invalid. Return error.
	                    MatchLength = MatchLength - 15
	                MatchLength = MatchLength + 15
	            MatchLength = MatchLength + 3
	            MatchOffset = NextBits >> (32 – MatchOffsetBitLength)
	            MatchOffset += (1 << MatchOffsetBitLength)
	            NextBits <<= MatchOffsetBitLength
	            ExtraBitCount -= MatchOffsetBitLength
	            If ExtraBitCount < 0
	                Read the next 2 bytes the same as the preceding (ExtraBitCount < 0) case
	            For i = 0 to MatchLength - 1
	                Output OutputBuffer[CurrentOutputPosition – MatchOffset + i]
	    End of block loop
	End of decoding loop

Best regards,
Jeff McCashland | Senior Escalation Engineer | Microsoft Protocol Open Specifications Team 
Phone: +1 (425) 703-8300 x38300 | Hours: 9am-5pm | Time zone: (UTC-08:00) Pacific Time (US and Canada)
Local country phone number found here: http://support.microsoft.com/globalenglish | Extension 1138300
We value your feedback.  My manager is Natesha Morrison (namorri), +1 (704) 430-4292

-----Original Message-----
From: Jeff McCashland 
Sent: Monday, July 6, 2020 6:55 AM
To: Aurélien Aptel <aaptel at suse.com>; cifs-protocol at lists.samba.org
Cc: support <support at mail.support.microsoft.com>
Subject: RE: [EXTERNAL] RE: [REG:120060621000848] [MS-XCA] L77+Huffman negative huffman symbol update

Glad I could help!

Best regards,
Jeff McCashland | Senior Escalation Engineer | Microsoft Protocol Open Specifications Team 

-----Original Message-----
From: Aurélien Aptel <aaptel at suse.com>
Sent: Monday, July 6, 2020 1:45 AM
To: Jeff McCashland <jeffm at microsoft.com>; cifs-protocol at lists.samba.org
Cc: support <support at mail.support.microsoft.com>
Subject: RE: [EXTERNAL] RE: [REG:120060621000848] [MS-XCA] L77+Huffman negative huffman symbol update

Hi Jeff,

Jeff McCashland <jeffm at microsoft.com> writes:
> We have investigated further, and determined that the section you're 
> asking about (the addition of the If HuffmanSymbol >= 0 block) is 
> implementation-specific code that was inadvertently added, and is not 
> necessary for Huffman compression or for >64k input buffers. Please 
> ignore that specific change. I have filed a request to remove that 
> section from the document. The only changes that should have been 
> included are for handling multiple Huffman tables when the input 
> buffer > 64k.

That makes sense. It seems MSFT should either document that implementation-specific method for building the decoding table or, as you are saying, remove the specific stuff from the decoding loop.

In any case, thanks for taking the time to look at this that deeply!

Cheers,
--
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