Skip to content

The runtime<->aspnetcore shared src is out of sync #18943

Closed

Description

@Tratcher

This is a tracking issue for when the shared src gets out of sync with it's runtime counterpart. See the ReadMe for details.

There is a github action that runs daily at https://github.com/dotnet/aspnetcore/actions and will re-open and comment on this bug if it detects any differences in the files shared between the repos. AspNetCore will triage and assign this issue to get the differences resolved.

Activity

  1. self-assigned this
    on Feb 10, 2020
  2. analogrelay commented on Feb 12, 2020

    @analogrelay
    Contributor

    We are currently in-sync.

  3. github-actions commented on Feb 14, 2020

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch master
    Your branch is up to date with 'origin/master'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/CopyToAspNetCore.cmd
    	modified:   src/Shared/runtime/CopyToRuntime.cmd
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/CopyToAspNetCore.cmd b/src/Shared/runtime/CopyToAspNetCore.cmd
    index 43eb681..65a341b 100644
    --- a/src/Shared/runtime/CopyToAspNetCore.cmd
    +++ b/src/Shared/runtime/CopyToAspNetCore.cmd
    @@ -10,5 +10,6 @@ IF [%remote_repo%] == [] (
     
     echo ASPNETCORE_REPO: %remote_repo%
     
    -robocopy . %remote_repo%\src\Shared\runtime /MIR
    -robocopy .\..\..\..\..\..\tests\Tests\System\Net\aspnetcore\ %remote_repo%\src\Shared\test\Shared.Tests\runtime /MIR
    +REM https://superuser.com/questions/280425/getting-robocopy-to-return-a-proper-exit-code
    +(robocopy . %remote_repo%\src\Shared\runtime /MIR) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0
    +(robocopy .\..\..\..\..\..\tests\Tests\System\Net\aspnetcore\ %remote_repo%\src\Shared\test\Shared.Tests\runtime /MIR) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0
    diff --git a/src/Shared/runtime/CopyToRuntime.cmd b/src/Shared/runtime/CopyToRuntime.cmd
    index 7f9e5b1..f1cb32d 100644
    --- a/src/Shared/runtime/CopyToRuntime.cmd
    +++ b/src/Shared/runtime/CopyToRuntime.cmd
    @@ -10,5 +10,6 @@ IF [%remote_repo%] == [] (
     
     echo RUNTIME_REPO: %remote_repo%
     
    -robocopy . %remote_repo%\src\libraries\Common\src\System\Net\Http\aspnetcore /MIR
    -robocopy .\..\test\Shared.Tests\runtime %remote_repo%\src\libraries\Common\tests\Tests\System\Net\aspnetcore /MIR
    +REM https://superuser.com/questions/280425/getting-robocopy-to-return-a-proper-exit-code
    +(robocopy . %remote_repo%\src\libraries\Common\src\System\Net\Http\aspnetcore /MIR) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0
    +(robocopy .\..\test\Shared.Tests\runtime %remote_repo%\src\libraries\Common\tests\Tests\System\Net\aspnetcore /MIR) ^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0
    
    
  4. ghost closed this as completedin #19062on Feb 14, 2020
  5. ghost added a commit that references this issue on Feb 14, 2020
  6. github-actions commented on Feb 19, 2020

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch master
    Your branch is up to date with 'origin/master'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    index 6f63d66..958dfac 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    @@ -269,6 +269,10 @@ namespace System.Net.Http.QPack
     
                                 if (_integerDecoder.BeginTryDecode((byte)prefixInt, LiteralHeaderFieldWithoutNameReferencePrefix, out intResult))
                                 {
    +                                if (intResult == 0)
    +                                {
    +                                    throw new QPackDecodingException(SR.Format(SR.net_http_invalid_header_name, ""));
    +                                }
                                     OnStringLength(intResult, State.HeaderName);
                                 }
                                 else
    @@ -303,6 +307,10 @@ namespace System.Net.Http.QPack
                     case State.HeaderNameLength:
                         if (_integerDecoder.TryDecode(b, out intResult))
                         {
    +                        if (intResult == 0)
    +                        {
    +                            throw new QPackDecodingException(SR.Format(SR.net_http_invalid_header_name, ""));
    +                        }
                             OnStringLength(intResult, nextState: State.HeaderName);
                         }
                         break;
    
    
  7. github-actions commented on Feb 20, 2020

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch master
    Your branch is up to date with 'origin/master'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    index 6f63d66..958dfac 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    @@ -269,6 +269,10 @@ namespace System.Net.Http.QPack
     
                                 if (_integerDecoder.BeginTryDecode((byte)prefixInt, LiteralHeaderFieldWithoutNameReferencePrefix, out intResult))
                                 {
    +                                if (intResult == 0)
    +                                {
    +                                    throw new QPackDecodingException(SR.Format(SR.net_http_invalid_header_name, ""));
    +                                }
                                     OnStringLength(intResult, State.HeaderName);
                                 }
                                 else
    @@ -303,6 +307,10 @@ namespace System.Net.Http.QPack
                     case State.HeaderNameLength:
                         if (_integerDecoder.TryDecode(b, out intResult))
                         {
    +                        if (intResult == 0)
    +                        {
    +                            throw new QPackDecodingException(SR.Format(SR.net_http_invalid_header_name, ""));
    +                        }
                             OnStringLength(intResult, nextState: State.HeaderName);
                         }
                         break;
    
    
  8. ghost closed this as completedin #19206on Feb 21, 2020
  9. 417 remaining items

  10. github-actions commented on Mar 15, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    	modified:   src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    	modified:   src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    	modified:   src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs b/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    index 4b08ef37..6b4fcb3a 100644
    --- a/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    +++ b/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    @@ -596,16 +596,10 @@ namespace System.Net.Http.HPack
                 {
                     if (_huffman)
                     {
    -                    int decodedLength = Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
    -                    if (decodedLength > _maxHeadersLength)
    -                    {
    -                        throw new HPackDecodingException(SR.Format(SR.net_http_headers_exceeded_length, _maxHeadersLength));
    -                    }
    -                    return decodedLength;
    +                    return Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
                     }
                     else
                     {
    -                    Debug.Assert(_stringLength <= _maxHeadersLength, "String length should have been checked prior to decode.");
                         EnsureStringCapacity(ref dst);
                         Buffer.BlockCopy(_stringOctets, 0, dst, 0, _stringLength);
                         return _stringLength;
    diff --git a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    index 155bb5fc..ea575da4 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    @@ -634,16 +634,10 @@ namespace System.Net.Http.QPack
     
                     if (_huffman)
                     {
    -                    int decodedLength = Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
    -                    if (decodedLength > _maxHeadersLength)
    -                    {
    -                        throw new QPackDecodingException(SR.Format(SR.net_http_headers_exceeded_length, _maxHeadersLength));
    -                    }
    -                    return decodedLength;
    +                    return Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
                     }
                     else
                     {
    -                    Debug.Assert(_stringLength <= _maxHeadersLength, "String length should have been checked prior to decode.");
                         Buffer.BlockCopy(_stringOctets, 0, dst, 0, _stringLength);
                         return _stringLength;
                     }
    diff --git a/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs b/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    index 9081b5be..2dde5440 100644
    --- a/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    +++ b/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    @@ -678,45 +678,6 @@ namespace System.Net.Http.Unit.Tests.HPack
                 Assert.Empty(_handler.DecodedHeaders);
             }
     
    -        [Fact]
    -        public void HuffmanDecodedHeaderName_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            // '0' (ASCII 48) has a 5-bit Huffman code (00000).
    -            // 16 '0' characters = 80 Huffman bits = 10 encoded bytes, but decodes to 16 bytes.
    -            // Encoded length (10) passes the pre-decode check (<= 10), but decoded length (16) exceeds the limit.
    -            HPackDecoder decoder = new HPackDecoder(DynamicTableInitialMaxSize, maxHeadersLength: 10);
    -
    -            byte[] encoded = [
    -                0x00,       // Literal header field without indexing, new name
    -                0x8a,       // Huffman flag set (0x80) + string length 10 (7-bit prefix)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10 bytes Huffman -> 16 '0' chars
    -                0x01,       // String length = 1 (no Huffman)
    -                0x61        // Value = "a"
    -            ];
    -
    -            HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(_handler.DecodedHeaders);
    -        }
    -
    -        [Fact]
    -        public void HuffmanDecodedHeaderValue_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            HPackDecoder decoder = new HPackDecoder(DynamicTableInitialMaxSize, maxHeadersLength: 10);
    -
    -            byte[] encoded = [
    -                0x00,       // Literal header field without indexing, new name
    -                0x01,       // String length = 1 (no Huffman)
    -                0x61,       // Name = "a"
    -                0x8a,       // Huffman flag set (0x80) + string length 10 (7-bit prefix)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  // 10 bytes Huffman -> 16 '0' chars
    -            ];
    -
    -            HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(_handler.DecodedHeaders);
    -        }
    -
             [Fact]
             public void DecodesStringLength_LimitConfigurable()
             {
    diff --git a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    index e78b9351..643bfdd8 100644
    --- a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    +++ b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    @@ -273,49 +273,6 @@ namespace System.Net.Http.Unit.Tests.QPack
                 Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderFieldString]);
             }
     
    -        [Fact]
    -        public void HuffmanDecodedHeaderName_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            // '0' (ASCII 48) has a 5-bit Huffman code (00000).
    -            // 16 '0' characters = 80 Huffman bits = 10 encoded bytes, but decodes to 16 bytes.
    -            // Encoded length (10) passes the pre-decode check (<= 10), but decoded length (16) exceeds the limit.
    -            using QPackDecoder decoder = new QPackDecoder(maxHeadersLength: 10);
    -            TestHttpHeadersHandler handler = new TestHttpHeadersHandler();
    -
    -            byte[] encoded = new byte[]
    -            {
    -                0x00, 0x00, // Required insert count (0) and base (0)
    -                0x2f, 0x03, // Literal field with literal name: N=0, H=1, name length = 10 (3-bit prefix: 7 + 3)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10 bytes Huffman -> 16 '0' chars
    -                0x01,       // Value length = 1 (no Huffman)
    -                0x61        // Value = "a"
    -            };
    -
    -            QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(handler.DecodedHeaders);
    -        }
    -
    -        [Fact]
    -        public void HuffmanDecodedHeaderValue_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            using QPackDecoder decoder = new QPackDecoder(maxHeadersLength: 10);
    -            TestHttpHeadersHandler handler = new TestHttpHeadersHandler();
    -
    -            byte[] encoded = new byte[]
    -            {
    -                0x00, 0x00, // Required insert count (0) and base (0)
    -                0x21,       // Literal field with literal name: N=0, H=0, name length = 1 (3-bit prefix)
    -                0x61,       // Name = "a"
    -                0x8a,       // Huffman flag set (0x80) + value length 10 (7-bit prefix)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  // 10 bytes Huffman -> 16 '0' chars
    -            };
    -
    -            QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(handler.DecodedHeaders);
    -        }
    -
             public static readonly TheoryData<byte[]> _incompleteHeaderBlockData = new TheoryData<byte[]>
             {
                 // Incomplete header
    
    
  11. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    	modified:   src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    	modified:   src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    	modified:   src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs b/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    index 4b08ef37..6b4fcb3a 100644
    --- a/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    +++ b/src/Shared/runtime/Http2/Hpack/HPackDecoder.cs
    @@ -596,16 +596,10 @@ namespace System.Net.Http.HPack
                 {
                     if (_huffman)
                     {
    -                    int decodedLength = Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
    -                    if (decodedLength > _maxHeadersLength)
    -                    {
    -                        throw new HPackDecodingException(SR.Format(SR.net_http_headers_exceeded_length, _maxHeadersLength));
    -                    }
    -                    return decodedLength;
    +                    return Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
                     }
                     else
                     {
    -                    Debug.Assert(_stringLength <= _maxHeadersLength, "String length should have been checked prior to decode.");
                         EnsureStringCapacity(ref dst);
                         Buffer.BlockCopy(_stringOctets, 0, dst, 0, _stringLength);
                         return _stringLength;
    diff --git a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    index 155bb5fc..ea575da4 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    @@ -634,16 +634,10 @@ namespace System.Net.Http.QPack
     
                     if (_huffman)
                     {
    -                    int decodedLength = Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
    -                    if (decodedLength > _maxHeadersLength)
    -                    {
    -                        throw new QPackDecodingException(SR.Format(SR.net_http_headers_exceeded_length, _maxHeadersLength));
    -                    }
    -                    return decodedLength;
    +                    return Huffman.Decode(new ReadOnlySpan<byte>(_stringOctets, 0, _stringLength), ref dst);
                     }
                     else
                     {
    -                    Debug.Assert(_stringLength <= _maxHeadersLength, "String length should have been checked prior to decode.");
                         Buffer.BlockCopy(_stringOctets, 0, dst, 0, _stringLength);
                         return _stringLength;
                     }
    diff --git a/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs b/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    index 9081b5be..2dde5440 100644
    --- a/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    +++ b/src/Shared/test/Shared.Tests/runtime/Http2/HPackDecoderTest.cs
    @@ -678,45 +678,6 @@ namespace System.Net.Http.Unit.Tests.HPack
                 Assert.Empty(_handler.DecodedHeaders);
             }
     
    -        [Fact]
    -        public void HuffmanDecodedHeaderName_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            // '0' (ASCII 48) has a 5-bit Huffman code (00000).
    -            // 16 '0' characters = 80 Huffman bits = 10 encoded bytes, but decodes to 16 bytes.
    -            // Encoded length (10) passes the pre-decode check (<= 10), but decoded length (16) exceeds the limit.
    -            HPackDecoder decoder = new HPackDecoder(DynamicTableInitialMaxSize, maxHeadersLength: 10);
    -
    -            byte[] encoded = [
    -                0x00,       // Literal header field without indexing, new name
    -                0x8a,       // Huffman flag set (0x80) + string length 10 (7-bit prefix)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10 bytes Huffman -> 16 '0' chars
    -                0x01,       // String length = 1 (no Huffman)
    -                0x61        // Value = "a"
    -            ];
    -
    -            HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(_handler.DecodedHeaders);
    -        }
    -
    -        [Fact]
    -        public void HuffmanDecodedHeaderValue_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            HPackDecoder decoder = new HPackDecoder(DynamicTableInitialMaxSize, maxHeadersLength: 10);
    -
    -            byte[] encoded = [
    -                0x00,       // Literal header field without indexing, new name
    -                0x01,       // String length = 1 (no Huffman)
    -                0x61,       // Name = "a"
    -                0x8a,       // Huffman flag set (0x80) + string length 10 (7-bit prefix)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  // 10 bytes Huffman -> 16 '0' chars
    -            ];
    -
    -            HPackDecodingException exception = Assert.Throws<HPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: _handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(_handler.DecodedHeaders);
    -        }
    -
             [Fact]
             public void DecodesStringLength_LimitConfigurable()
             {
    diff --git a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    index e78b9351..643bfdd8 100644
    --- a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    +++ b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    @@ -273,49 +273,6 @@ namespace System.Net.Http.Unit.Tests.QPack
                 Assert.Equal(_headerValueString, _handler.DecodedHeaders[_literalHeaderFieldString]);
             }
     
    -        [Fact]
    -        public void HuffmanDecodedHeaderName_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            // '0' (ASCII 48) has a 5-bit Huffman code (00000).
    -            // 16 '0' characters = 80 Huffman bits = 10 encoded bytes, but decodes to 16 bytes.
    -            // Encoded length (10) passes the pre-decode check (<= 10), but decoded length (16) exceeds the limit.
    -            using QPackDecoder decoder = new QPackDecoder(maxHeadersLength: 10);
    -            TestHttpHeadersHandler handler = new TestHttpHeadersHandler();
    -
    -            byte[] encoded = new byte[]
    -            {
    -                0x00, 0x00, // Required insert count (0) and base (0)
    -                0x2f, 0x03, // Literal field with literal name: N=0, H=1, name length = 10 (3-bit prefix: 7 + 3)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 10 bytes Huffman -> 16 '0' chars
    -                0x01,       // Value length = 1 (no Huffman)
    -                0x61        // Value = "a"
    -            };
    -
    -            QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(handler.DecodedHeaders);
    -        }
    -
    -        [Fact]
    -        public void HuffmanDecodedHeaderValue_ExceedsLimitAfterDecoding_Throws()
    -        {
    -            using QPackDecoder decoder = new QPackDecoder(maxHeadersLength: 10);
    -            TestHttpHeadersHandler handler = new TestHttpHeadersHandler();
    -
    -            byte[] encoded = new byte[]
    -            {
    -                0x00, 0x00, // Required insert count (0) and base (0)
    -                0x21,       // Literal field with literal name: N=0, H=0, name length = 1 (3-bit prefix)
    -                0x61,       // Name = "a"
    -                0x8a,       // Huffman flag set (0x80) + value length 10 (7-bit prefix)
    -                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00  // 10 bytes Huffman -> 16 '0' chars
    -            };
    -
    -            QPackDecodingException exception = Assert.Throws<QPackDecodingException>(() => decoder.Decode(encoded, endHeaders: true, handler: handler));
    -            Assert.Equal(SR.Format(SR.net_http_headers_exceeded_length, 10), exception.Message);
    -            Assert.Empty(handler.DecodedHeaders);
    -        }
    -
             public static readonly TheoryData<byte[]> _incompleteHeaderBlockData = new TheoryData<byte[]>
             {
                 // Incomplete header
    
    
  12. github-actions commented on May 9, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    	modified:   src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    	modified:   src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs b/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    index dab58814..45bb2a6b 100644
    --- a/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    +++ b/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     #nullable enable
    @@ -596,7 +596,7 @@ namespace System.Net.Http.HPack
             /// Encodes a "Literal Header Field without Indexing" to a new array, but only the index portion;
             /// a subsequent call to <c>EncodeStringLiteral</c> must be used to encode the associated value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index)
             {
                 Span<byte> span = stackalloc byte[256];
                 bool success = EncodeLiteralHeaderFieldWithoutIndexing(index, span, out int length);
    @@ -608,7 +608,7 @@ namespace System.Net.Http.HPack
             /// Encodes a "Literal Header Field without Indexing - New Name" to a new array, but only the name portion;
             /// a subsequent call to <c>EncodeStringLiteral</c> must be used to encode the associated value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingNewNameToAllocatedArray(string name)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingNewNameToAllocatedArray(string name)
             {
                 Span<byte> span = stackalloc byte[256];
                 bool success = EncodeLiteralHeaderFieldWithoutIndexingNewName(name, span, out int length);
    @@ -617,7 +617,7 @@ namespace System.Net.Http.HPack
             }
     
             /// <summary>Encodes a "Literal Header Field without Indexing" to a new array.</summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index, string value)
             {
                 Span<byte> span =
     #if DEBUG
    diff --git a/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs b/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    index c7f1ec90..f1f68905 100644
    --- a/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    +++ b/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     using System.Buffers;
    @@ -96,7 +96,7 @@ namespace System.Net.Http
                 // Cold path: copy to a temporary buffer before calling span-based read.
                 return TryReadSlow(ref reader, out value);
     
    -            static bool TryReadSlow(ref SequenceReader<byte> reader, out long value)
    +            static unsafe bool TryReadSlow(ref SequenceReader<byte> reader, out long value)
                 {
                     ReadOnlySpan<byte> span = reader.CurrentSpan;
     
    diff --git a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    index 5d96530b..07ff8029 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     #nullable enable
    @@ -34,7 +34,7 @@ namespace System.Net.Http.QPack
                 }
             }
     
    -        public static byte[] EncodeStaticIndexedHeaderFieldToArray(int index)
    +        public static unsafe byte[] EncodeStaticIndexedHeaderFieldToArray(int index)
             {
                 Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -88,7 +88,7 @@ namespace System.Net.Http.QPack
             /// <summary>
             /// Encodes just the name part of a Literal Header Field With Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index)
             {
                 Span<byte> temp = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -99,7 +99,7 @@ namespace System.Net.Http.QPack
                 return temp.Slice(0, headerBytesWritten).ToArray();
             }
     
    -        public static byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index, string value)
             {
                 Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
                 bool res = EncodeLiteralHeaderFieldWithStaticNameReference(index, value, temp, out int bytesWritten);
    @@ -159,7 +159,7 @@ namespace System.Net.Http.QPack
             /// <summary>
             /// Encodes just the value part of a Literawl Header Field Without Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name)
             {
                 Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -169,7 +169,7 @@ namespace System.Net.Http.QPack
                 return temp.Slice(0, nameLength).ToArray();
             }
     
    -        public static byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name, string value)
             {
                 Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
     
    
    
  13. github-actions commented on May 10, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    	modified:   src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    	modified:   src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs b/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    index dab58814..45bb2a6b 100644
    --- a/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    +++ b/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     #nullable enable
    @@ -596,7 +596,7 @@ namespace System.Net.Http.HPack
             /// Encodes a "Literal Header Field without Indexing" to a new array, but only the index portion;
             /// a subsequent call to <c>EncodeStringLiteral</c> must be used to encode the associated value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index)
             {
                 Span<byte> span = stackalloc byte[256];
                 bool success = EncodeLiteralHeaderFieldWithoutIndexing(index, span, out int length);
    @@ -608,7 +608,7 @@ namespace System.Net.Http.HPack
             /// Encodes a "Literal Header Field without Indexing - New Name" to a new array, but only the name portion;
             /// a subsequent call to <c>EncodeStringLiteral</c> must be used to encode the associated value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingNewNameToAllocatedArray(string name)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingNewNameToAllocatedArray(string name)
             {
                 Span<byte> span = stackalloc byte[256];
                 bool success = EncodeLiteralHeaderFieldWithoutIndexingNewName(name, span, out int length);
    @@ -617,7 +617,7 @@ namespace System.Net.Http.HPack
             }
     
             /// <summary>Encodes a "Literal Header Field without Indexing" to a new array.</summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index, string value)
             {
                 Span<byte> span =
     #if DEBUG
    diff --git a/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs b/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    index c7f1ec90..f1f68905 100644
    --- a/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    +++ b/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     using System.Buffers;
    @@ -96,7 +96,7 @@ namespace System.Net.Http
                 // Cold path: copy to a temporary buffer before calling span-based read.
                 return TryReadSlow(ref reader, out value);
     
    -            static bool TryReadSlow(ref SequenceReader<byte> reader, out long value)
    +            static unsafe bool TryReadSlow(ref SequenceReader<byte> reader, out long value)
                 {
                     ReadOnlySpan<byte> span = reader.CurrentSpan;
     
    diff --git a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    index 5d96530b..07ff8029 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     #nullable enable
    @@ -34,7 +34,7 @@ namespace System.Net.Http.QPack
                 }
             }
     
    -        public static byte[] EncodeStaticIndexedHeaderFieldToArray(int index)
    +        public static unsafe byte[] EncodeStaticIndexedHeaderFieldToArray(int index)
             {
                 Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -88,7 +88,7 @@ namespace System.Net.Http.QPack
             /// <summary>
             /// Encodes just the name part of a Literal Header Field With Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index)
             {
                 Span<byte> temp = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -99,7 +99,7 @@ namespace System.Net.Http.QPack
                 return temp.Slice(0, headerBytesWritten).ToArray();
             }
     
    -        public static byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index, string value)
             {
                 Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
                 bool res = EncodeLiteralHeaderFieldWithStaticNameReference(index, value, temp, out int bytesWritten);
    @@ -159,7 +159,7 @@ namespace System.Net.Http.QPack
             /// <summary>
             /// Encodes just the value part of a Literawl Header Field Without Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name)
             {
                 Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -169,7 +169,7 @@ namespace System.Net.Http.QPack
                 return temp.Slice(0, nameLength).ToArray();
             }
     
    -        public static byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name, string value)
             {
                 Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
     
    
    
  14. github-actions commented on May 11, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    	modified:   src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    	modified:   src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs b/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    index dab58814..45bb2a6b 100644
    --- a/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    +++ b/src/Shared/runtime/Http2/Hpack/HPackEncoder.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     #nullable enable
    @@ -596,7 +596,7 @@ namespace System.Net.Http.HPack
             /// Encodes a "Literal Header Field without Indexing" to a new array, but only the index portion;
             /// a subsequent call to <c>EncodeStringLiteral</c> must be used to encode the associated value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index)
             {
                 Span<byte> span = stackalloc byte[256];
                 bool success = EncodeLiteralHeaderFieldWithoutIndexing(index, span, out int length);
    @@ -608,7 +608,7 @@ namespace System.Net.Http.HPack
             /// Encodes a "Literal Header Field without Indexing - New Name" to a new array, but only the name portion;
             /// a subsequent call to <c>EncodeStringLiteral</c> must be used to encode the associated value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingNewNameToAllocatedArray(string name)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingNewNameToAllocatedArray(string name)
             {
                 Span<byte> span = stackalloc byte[256];
                 bool success = EncodeLiteralHeaderFieldWithoutIndexingNewName(name, span, out int length);
    @@ -617,7 +617,7 @@ namespace System.Net.Http.HPack
             }
     
             /// <summary>Encodes a "Literal Header Field without Indexing" to a new array.</summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutIndexingToAllocatedArray(int index, string value)
             {
                 Span<byte> span =
     #if DEBUG
    diff --git a/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs b/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    index c7f1ec90..f1f68905 100644
    --- a/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    +++ b/src/Shared/runtime/Http3/Helpers/VariableLengthIntegerHelper.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     using System.Buffers;
    @@ -96,7 +96,7 @@ namespace System.Net.Http
                 // Cold path: copy to a temporary buffer before calling span-based read.
                 return TryReadSlow(ref reader, out value);
     
    -            static bool TryReadSlow(ref SequenceReader<byte> reader, out long value)
    +            static unsafe bool TryReadSlow(ref SequenceReader<byte> reader, out long value)
                 {
                     ReadOnlySpan<byte> span = reader.CurrentSpan;
     
    diff --git a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    index 5d96530b..07ff8029 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackEncoder.cs
    @@ -1,4 +1,4 @@
    -// Licensed to the .NET Foundation under one or more agreements.
    +// Licensed to the .NET Foundation under one or more agreements.
     // The .NET Foundation licenses this file to you under the MIT license.
     
     #nullable enable
    @@ -34,7 +34,7 @@ namespace System.Net.Http.QPack
                 }
             }
     
    -        public static byte[] EncodeStaticIndexedHeaderFieldToArray(int index)
    +        public static unsafe byte[] EncodeStaticIndexedHeaderFieldToArray(int index)
             {
                 Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -88,7 +88,7 @@ namespace System.Net.Http.QPack
             /// <summary>
             /// Encodes just the name part of a Literal Header Field With Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index)
             {
                 Span<byte> temp = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -99,7 +99,7 @@ namespace System.Net.Http.QPack
                 return temp.Slice(0, headerBytesWritten).ToArray();
             }
     
    -        public static byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithStaticNameReferenceToArray(int index, string value)
             {
                 Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
                 bool res = EncodeLiteralHeaderFieldWithStaticNameReference(index, value, temp, out int bytesWritten);
    @@ -159,7 +159,7 @@ namespace System.Net.Http.QPack
             /// <summary>
             /// Encodes just the value part of a Literawl Header Field Without Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
             /// </summary>
    -        public static byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name)
             {
                 Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
     
    @@ -169,7 +169,7 @@ namespace System.Net.Http.QPack
                 return temp.Slice(0, nameLength).ToArray();
             }
     
    -        public static byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name, string value)
    +        public static unsafe byte[] EncodeLiteralHeaderFieldWithoutNameReferenceToArray(string name, string value)
             {
                 Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
     
    
    
  15. removed their assignment
    on May 11, 2026
  16. github-actions commented on Aug 13, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    	modified:   src/Shared/runtime/SR.resx
    	modified:   src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    index f4b3691e..155bb5fc 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    @@ -712,8 +712,6 @@ namespace System.Net.Http.QPack
     
             private void OnIndexedHeaderName(int index)
             {
    -            ThrowIfInvalidStaticIndex(index);
    -
                 _headerStaticIndex = index;
                 _state = State.HeaderValueLength;
             }
    @@ -753,20 +751,10 @@ namespace System.Net.Http.QPack
     
             private void OnIndexedHeaderField(int index, IHttpStreamHeadersHandler handler)
             {
    -            ThrowIfInvalidStaticIndex(index);
    -
                 handler.OnStaticIndexedHeader(index);
                 _state = State.CompressedHeaders;
             }
     
    -        private static void ThrowIfInvalidStaticIndex(int index)
    -        {
    -            if (index >= H3StaticTable.Count)
    -            {
    -                throw new QPackDecodingException(SR.Format(SR.net_http_qpack_invalid_index, index));
    -            }
    -        }
    -
             private static void ThrowDynamicTableNotSupported()
             {
                 throw new QPackDecodingException(SR.net_http_qpack_no_dynamic_table);
    diff --git a/src/Shared/runtime/SR.resx b/src/Shared/runtime/SR.resx
    index 54ec7fab..9c5ece61 100644
    --- a/src/Shared/runtime/SR.resx
    +++ b/src/Shared/runtime/SR.resx
    @@ -150,9 +150,6 @@
       <data name="net_http_invalid_header_name" xml:space="preserve">
         <value>Received an invalid header name: '{0}'.</value>
       </data>
    -  <data name="net_http_qpack_invalid_index" xml:space="preserve">
    -    <value>Invalid header index: {0} is outside of the static table.</value>
    -  </data>
       <data name="net_http_qpack_no_dynamic_table" xml:space="preserve">
         <value>No dynamic table support</value>
       </data>
    diff --git a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    index 6414acbc..e78b9351 100644
    --- a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    +++ b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    @@ -340,20 +340,6 @@ namespace System.Net.Http.Unit.Tests.QPack
                 Assert.Empty(_handler.DecodedHeaders);
             }
     
    -        [Theory]
    -        // Indexed Field Line - Static Table - Index 99 (out of range)
    -        [InlineData(new byte[] { 0xff, 0x24 }, 99)]
    -        // Literal Header Field With Name Reference - Static Table - Index 99 (out of range)
    -        [InlineData(new byte[] { 0x5f, 0x54, 0x01, 0x61 }, 99)]
    -        public void DecodesIndexOutsideStaticTable_Error(byte[] encoded, int index)
    -        {
    -            _decoder.Decode([0x00, 0x00], endHeaders: false, handler: _handler);
    -
    -            var exception = Assert.Throws<QPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
    -            Assert.Equal(SR.Format(SR.net_http_qpack_invalid_index, index), exception.Message);
    -            Assert.Empty(_handler.DecodedHeaders);
    -        }
    -
             private static void TestDecodeWithoutIndexing(byte[] encoded, string expectedHeaderName, string expectedHeaderValue)
             {
                 KeyValuePair<string, string>[] expectedValues = new[] { new KeyValuePair<string, string>(expectedHeaderName, expectedHeaderValue) };
    
    
  17. github-actions commented on Aug 14, 2026

    @github-actions
    Contributor

    The shared code is out of sync.

    The Diff
    On branch main
    Your branch is up to date with 'origin/main'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
    	modified:   src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    	modified:   src/Shared/runtime/SR.resx
    	modified:   src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    diff --git a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    index f4b3691e..155bb5fc 100644
    --- a/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    +++ b/src/Shared/runtime/Http3/QPack/QPackDecoder.cs
    @@ -712,8 +712,6 @@ namespace System.Net.Http.QPack
     
             private void OnIndexedHeaderName(int index)
             {
    -            ThrowIfInvalidStaticIndex(index);
    -
                 _headerStaticIndex = index;
                 _state = State.HeaderValueLength;
             }
    @@ -753,20 +751,10 @@ namespace System.Net.Http.QPack
     
             private void OnIndexedHeaderField(int index, IHttpStreamHeadersHandler handler)
             {
    -            ThrowIfInvalidStaticIndex(index);
    -
                 handler.OnStaticIndexedHeader(index);
                 _state = State.CompressedHeaders;
             }
     
    -        private static void ThrowIfInvalidStaticIndex(int index)
    -        {
    -            if (index >= H3StaticTable.Count)
    -            {
    -                throw new QPackDecodingException(SR.Format(SR.net_http_qpack_invalid_index, index));
    -            }
    -        }
    -
             private static void ThrowDynamicTableNotSupported()
             {
                 throw new QPackDecodingException(SR.net_http_qpack_no_dynamic_table);
    diff --git a/src/Shared/runtime/SR.resx b/src/Shared/runtime/SR.resx
    index 54ec7fab..9c5ece61 100644
    --- a/src/Shared/runtime/SR.resx
    +++ b/src/Shared/runtime/SR.resx
    @@ -150,9 +150,6 @@
       <data name="net_http_invalid_header_name" xml:space="preserve">
         <value>Received an invalid header name: '{0}'.</value>
       </data>
    -  <data name="net_http_qpack_invalid_index" xml:space="preserve">
    -    <value>Invalid header index: {0} is outside of the static table.</value>
    -  </data>
       <data name="net_http_qpack_no_dynamic_table" xml:space="preserve">
         <value>No dynamic table support</value>
       </data>
    diff --git a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    index 6414acbc..e78b9351 100644
    --- a/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    +++ b/src/Shared/test/Shared.Tests/runtime/Http3/QPackDecoderTest.cs
    @@ -340,20 +340,6 @@ namespace System.Net.Http.Unit.Tests.QPack
                 Assert.Empty(_handler.DecodedHeaders);
             }
     
    -        [Theory]
    -        // Indexed Field Line - Static Table - Index 99 (out of range)
    -        [InlineData(new byte[] { 0xff, 0x24 }, 99)]
    -        // Literal Header Field With Name Reference - Static Table - Index 99 (out of range)
    -        [InlineData(new byte[] { 0x5f, 0x54, 0x01, 0x61 }, 99)]
    -        public void DecodesIndexOutsideStaticTable_Error(byte[] encoded, int index)
    -        {
    -            _decoder.Decode([0x00, 0x00], endHeaders: false, handler: _handler);
    -
    -            var exception = Assert.Throws<QPackDecodingException>(() => _decoder.Decode(encoded, endHeaders: true, handler: _handler));
    -            Assert.Equal(SR.Format(SR.net_http_qpack_invalid_index, index), exception.Message);
    -            Assert.Empty(_handler.DecodedHeaders);
    -        }
    -
             private static void TestDecodeWithoutIndexing(byte[] encoded, string expectedHeaderName, string expectedHeaderValue)
             {
                 KeyValuePair<string, string>[] expectedValues = new[] { new KeyValuePair<string, string>(expectedHeaderName, expectedHeaderValue) };
    
    
  18. added a commit that references this issue on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bot: Do Not LockIndicates that the bot should not lock this issue due to inactivity.area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-kestreltask

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions