diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 78093ce137e080..b5495d6d07be18 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -15,7 +15,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "11.0.0-prerelease.26370.1", + "version": "11.0.0-prerelease.26419.1", "commands": [ "xharness" ] diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 68613cbde6e0e5..3500b2b6064c46 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/icu - 9adc45770f79d8d0161ac8972a0036e36bd48ded + e38cd61cc00b753af76ed9d31a7acbeabc6a3238 https://github.com/dotnet/msquic @@ -55,14 +55,14 @@ 803d8598f98fb4efd94604b32627ee9407f246db - + https://github.com/dotnet/cecil - eebca361032c2a1ded7be6244b91b757d54be02a + 5850baac30805f358b113f0b12966ce234023725 - + https://github.com/dotnet/cecil - eebca361032c2a1ded7be6244b91b757d54be02a + 5850baac30805f358b113f0b12966ce234023725 @@ -321,17 +321,17 @@ https://github.com/dotnet/runtime b030c4dfdfa1bf287f10f96006619a06bc2000ae - + https://github.com/dotnet/xharness - 65e5795252474ebd04e4e872bd4152e86c558209 + 8dd9b8e6004e22c7b120af0631f0809865ff2088 - + https://github.com/dotnet/xharness - 65e5795252474ebd04e4e872bd4152e86c558209 + 8dd9b8e6004e22c7b120af0631f0809865ff2088 - + https://github.com/dotnet/xharness - 65e5795252474ebd04e4e872bd4152e86c558209 + 8dd9b8e6004e22c7b120af0631f0809865ff2088 https://github.com/dotnet/arcade @@ -361,17 +361,17 @@ https://github.com/dotnet/runtime-assets 12466630283f5e0fe1869b52184aece70d3967a4 - + https://github.com/dotnet/roslyn - 0118715be822b3f2f1e6a35ec1f79d7e245759c1 + 66541625d45561161a206b6aad528b9c95c43259 - + https://github.com/dotnet/roslyn - 0118715be822b3f2f1e6a35ec1f79d7e245759c1 + 66541625d45561161a206b6aad528b9c95c43259 - + https://github.com/dotnet/roslyn - 0118715be822b3f2f1e6a35ec1f79d7e245759c1 + 66541625d45561161a206b6aad528b9c95c43259 https://github.com/dotnet/roslyn-analyzers @@ -382,9 +382,9 @@ 5ef1abb57ce3df89eae65ecadeb1ddbab323ae05 - + https://github.com/dotnet/roslyn - 0118715be822b3f2f1e6a35ec1f79d7e245759c1 + 66541625d45561161a206b6aad528b9c95c43259 diff --git a/eng/Versions.props b/eng/Versions.props index f9aaad8c1d4895..1b7f6a44f00a5d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -43,9 +43,9 @@ Any tools that contribute to the design-time experience should use the MicrosoftCodeAnalysisVersion_LatestVS property above to ensure they do not break the local dev experience. --> - 4.12.0-3.26274.2 - 4.12.0-3.26274.2 - 4.12.0-3.26274.2 + 4.12.0-3.26423.8 + 4.12.0-3.26423.8 + 4.12.0-3.26423.8 - 11.0.0-prerelease.26370.1 - 11.0.0-prerelease.26370.1 - 11.0.0-prerelease.26370.1 + 11.0.0-prerelease.26419.1 + 11.0.0-prerelease.26419.1 + 11.0.0-prerelease.26419.1 9.0.0-alpha.0.26202.3 3.12.0 @@ -222,11 +222,11 @@ 9.0.0-preview-20241010.1 - 0.11.5-alpha.26404.3 + 0.11.5-alpha.26418.4 9.0.0-rtm.24511.16 - 9.0.0-rtm.26407.5 + 9.0.0-rtm.26458.1 2.5.10 diff --git a/src/libraries/System.Net.HttpListener/tests/InvalidClientRequestTests.cs b/src/libraries/System.Net.HttpListener/tests/InvalidClientRequestTests.cs index 76732e7c918bf3..a8c3feddaded32 100644 --- a/src/libraries/System.Net.HttpListener/tests/InvalidClientRequestTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/InvalidClientRequestTests.cs @@ -74,8 +74,11 @@ public static IEnumerable InvalidRequest_TestData() yield return new object[] { "GET {path} HTTP/1.1", null, new string[] { "Content-Length: -9223372036854775809" }, "\r\n", "Bad Request" }; yield return new object[] { "GET {path} HTTP/1.1", null, new string[] { "Content-Length: 1", "Content-Length: 2" }, "\r\n", "Bad Request" }; - yield return new object[] { "POST {path} HTTP/1.1", null, new string[] { "Content-Length: 9223372036854775808" }, "\r\n", "Bad Request" }; // long.MaxValue + 1 - yield return new object[] { "POST {path} HTTP/1.1", null, new string[] { "Content-Length: 18446744073709551615" }, "\r\n", "Bad Request" }; // ulong.MaxValue + if (Helpers.IsManagedImplementation) + { + yield return new object[] { "POST {path} HTTP/1.1", null, new string[] { "Content-Length: 9223372036854775808" }, "\r\n", "Bad Request" }; // long.MaxValue + 1 + yield return new object[] { "POST {path} HTTP/1.1", null, new string[] { "Content-Length: 18446744073709551615" }, "\r\n", "Bad Request" }; // ulong.MaxValue + } yield return new object[] { "GET {path} HTTP/1.1", null, new string[] { "Transfer-Encoding: garbage" }, "\r\n", "Not Implemented" }; yield return new object[] { "POST {path} HTTP/1.1", null, new string[] { "Transfer-Encoding: garbage" }, "\r\n", "Not Implemented" }; diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs index 00fb1ee8c72b53..9b58f958748327 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicConfiguration.cs @@ -284,7 +284,11 @@ private static unsafe MsQuicConfigurationSafeHandle CreateInternal(QUIC_SETTINGS ThrowHelper.ThrowIfMsQuicError(status, SR.net_quic_tls_version_notsupported); } - if (status == MsQuic.QUIC_STATUS_CERT_NO_CERT && certificate != null && certificate.HasPrivateKey()) + // Schannel reports SEC_E_NO_CREDENTIALS (mapped to QUIC_STATUS_CERT_NO_CERT) for + // server certificates and SEC_E_UNKNOWN_CREDENTIALS for client certificates when the + // private key is ephemeral, which is not supported on Windows. + if ((status == MsQuic.QUIC_STATUS_CERT_NO_CERT || (Interop.SECURITY_STATUS)status == Interop.SECURITY_STATUS.UnknownCredentials) && + certificate is not null && certificate.HasPrivateKey()) { using Microsoft.Win32.SafeHandles.SafeCertContextHandle safeCertContextHandle = Interop.Crypt32.CertDuplicateCertificateContext(certificate.Handle); if (safeCertContextHandle.HasEphemeralPrivateKey) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs index f57fd7651c3ed6..03332fd0420539 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicConnection.cs @@ -403,9 +403,9 @@ private async ValueTask FinishConnectAsync(QuicClientConnectionOptions options, // RFC 6066 forbids IP literals. // IDN mapping is handled by MsQuic. - string sni = (TargetHostNameHelper.IsValidAddress(options.ClientAuthenticationOptions.TargetHost) ? null : options.ClientAuthenticationOptions.TargetHost) ?? host ?? string.Empty; + string? sni = (TargetHostNameHelper.IsValidAddress(options.ClientAuthenticationOptions.TargetHost) ? null : options.ClientAuthenticationOptions.TargetHost) ?? host; - IntPtr targetHostPtr = Marshal.StringToCoTaskMemUTF8(sni); + IntPtr targetHostPtr = !string.IsNullOrEmpty(sni) ? Marshal.StringToCoTaskMemUTF8(sni) : IntPtr.Zero; try { unsafe @@ -421,7 +421,10 @@ private async ValueTask FinishConnectAsync(QuicClientConnectionOptions options, } finally { - Marshal.FreeCoTaskMem(targetHostPtr); + if (targetHostPtr != IntPtr.Zero) + { + Marshal.FreeCoTaskMem(targetHostPtr); + } } } diff --git a/src/libraries/System.Security.Cryptography.Xml/tests/EncryptedXmlTests.cs b/src/libraries/System.Security.Cryptography.Xml/tests/EncryptedXmlTests.cs index 458a8cf6d5b26a..a3477a371b2941 100644 --- a/src/libraries/System.Security.Cryptography.Xml/tests/EncryptedXmlTests.cs +++ b/src/libraries/System.Security.Cryptography.Xml/tests/EncryptedXmlTests.cs @@ -299,6 +299,7 @@ public static IEnumerable EncodedDtdTransformChainLimits() yield return new object[] { requiredTransformCount, false }; } + [ActiveIssue("https://github.com/dotnet/runtime/issues/131638")] [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [MemberData(nameof(EncodedDtdTransformChainLimits))] public static void EncryptedXml_DecryptedEncodedDtd_WithExactTransformChainLimit(int maxTransformsPerChain, bool expectTransformLimit) @@ -321,6 +322,7 @@ public static void EncryptedXml_DecryptedEncodedDtd_WithExactTransformChainLimit }, maxTransformsPerChain.ToString(CultureInfo.InvariantCulture), expectTransformLimit.ToString()).Dispose(); } + [ActiveIssue("https://github.com/dotnet/runtime/issues/131638")] [ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] public static void EncryptedXml_DecryptedEncodedDtd_WithUnlimitedTransformChain() { diff --git a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PropertyRef.cs b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PropertyRef.cs index d1f4c0afaf8dc9..7e605257a34646 100644 --- a/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PropertyRef.cs +++ b/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PropertyRef.cs @@ -41,8 +41,10 @@ internal readonly struct PropertyRef(ulong key, JsonPropertyInfo? info, byte[] u [MethodImpl(MethodImplOptions.AggressiveInlining)] public bool Equals(ReadOnlySpan propertyName, ulong key) { - // If the property name is less than 8 bytes, it is embedded in the key so no further comparison is necessary. - return key == Key && (propertyName.Length <= PropertyNameKeyLength || propertyName.SequenceEqual(Utf8PropertyName)); + // If both property names are less than 8 bytes, they are embedded in the key so no further comparison is necessary. + return key == Key && + ((propertyName.Length <= PropertyNameKeyLength && Utf8PropertyName.Length <= PropertyNameKeyLength) + || propertyName.SequenceEqual(Utf8PropertyName)); } /// diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CacheTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CacheTests.cs index 5a75a784cd3e4d..6e6451d96fbb9e 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CacheTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CacheTests.cs @@ -165,6 +165,56 @@ public static void PropertyCacheWithMinInputsLast() JsonSerializer.Deserialize(json, options); } + [Theory] + [InlineData(0)] + [InlineData(1)] + [InlineData(2)] + [InlineData(3)] + [InlineData(4)] + [InlineData(5)] + [InlineData(6)] + [InlineData(7)] + public static void PropertyCache_NamesWithSameKeyButDifferentLength_AreDistinct(int shortNameLength) + { + string shortName = new('a', shortNameLength); + string longName = + shortName + + new string('\0', 7 - shortNameLength) + + new string('b', 249 + shortNameLength); + + Assert.Equal(256, longName.Length - shortName.Length); + + var options = new JsonSerializerOptions + { + TypeInfoResolver = new DefaultJsonTypeInfoResolver + { + Modifiers = + { + // Customize the name so the theory can exercise every length with one POCO type. + typeInfo => + { + if (typeInfo.Type == typeof(PropertyKeyLengthPoco)) + { + typeInfo.Properties[0].Name = shortName; + } + } + } + } + }; + + string json = JsonSerializer.Serialize(new Dictionary { [longName] = "42" }); + Assert.Null(JsonSerializer.Deserialize(json, options).Value); + + json = JsonSerializer.Serialize(new Dictionary { [shortName] = "42" }); + Assert.Equal("42", JsonSerializer.Deserialize(json, options).Value); + } + + private class PropertyKeyLengthPoco + { + // The declared name is irrelevant because the resolver replaces it. + public string Value { get; set; } + } + // Use a common options instance to encourage additional metadata collisions across types. Also since // this options is not the default options instance the tests will not use previously cached metadata. private static JsonSerializerOptions s_options = new JsonSerializerOptions { IncludeFields = true };