From e0d93683e406d1d2d3c49d3ee27f1a8270c503e1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 11:10:51 +0000 Subject: [PATCH 1/5] Initial plan From d75734d898065da58031636bed0f76c611999d63 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 11:14:26 +0000 Subject: [PATCH 2/5] Fix NativeAOT TryGetIntegerValue to handle 0x/0X hex prefix Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b2cf8499-44ac-4e9a-995b-c72b36e081a2 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com> --- src/coreclr/nativeaot/Runtime/RhConfig.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/Runtime/RhConfig.cpp b/src/coreclr/nativeaot/Runtime/RhConfig.cpp index af6d130bd7dde9..859899d25b0847 100644 --- a/src/coreclr/nativeaot/Runtime/RhConfig.cpp +++ b/src/coreclr/nativeaot/Runtime/RhConfig.cpp @@ -56,7 +56,12 @@ bool RhConfig::Environment::TryGetIntegerValue(const char* name, uint64_t* value // Environment variable was set. Convert it to an integer. uint64_t uiResult = 0; - for (uint32_t i = 0; i < cchResult; i++) + uint32_t startIndex = 0; + if (!decimal && cchResult >= 2 && buffer[0] == '0' && (buffer[1] == 'x' || buffer[1] == 'X')) + { + startIndex = 2; + } + for (uint32_t i = startIndex; i < cchResult; i++) { TCHAR ch = buffer[i]; From b101a8836b01cb265af990b2402d72d4f6719137 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Fri, 1 May 2026 04:21:26 -0700 Subject: [PATCH 3/5] Update Program.cs --- src/coreclr/tools/aot/ILCompiler/Program.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs index 2ba003f6a177c5..469a09b95224a7 100644 --- a/src/coreclr/tools/aot/ILCompiler/Program.cs +++ b/src/coreclr/tools/aot/ILCompiler/Program.cs @@ -257,8 +257,7 @@ public int Run() } } - if (Get(_command.EnableDebugInfo)) - compilationRoots.Add(new ManagedDataDescriptorProvider()); + compilationRoots.Add(new ManagedDataDescriptorProvider()); string win32resourcesModule = Get(_command.Win32ResourceModuleName); if (typeSystemContext.Target.IsWindows && !string.IsNullOrEmpty(win32resourcesModule)) From 54028e7cadcb498878854811f3a98ee487b28b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Sat, 2 May 2026 05:47:52 +0900 Subject: [PATCH 4/5] Conditionally add ManagedDataDescriptorProvider --- src/coreclr/tools/aot/ILCompiler/Program.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs index 469a09b95224a7..2ba003f6a177c5 100644 --- a/src/coreclr/tools/aot/ILCompiler/Program.cs +++ b/src/coreclr/tools/aot/ILCompiler/Program.cs @@ -257,7 +257,8 @@ public int Run() } } - compilationRoots.Add(new ManagedDataDescriptorProvider()); + if (Get(_command.EnableDebugInfo)) + compilationRoots.Add(new ManagedDataDescriptorProvider()); string win32resourcesModule = Get(_command.Win32ResourceModuleName); if (typeSystemContext.Target.IsWindows && !string.IsNullOrEmpty(win32resourcesModule)) From a03342d35a462ac2dccc54272d65547b69c1f20f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 1 May 2026 20:49:01 +0000 Subject: [PATCH 5/5] Return false when hex prefix has no following digits Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/875e04c9-b166-49fd-aefe-adaf5f6bd0b4 Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com> --- src/coreclr/nativeaot/Runtime/RhConfig.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/nativeaot/Runtime/RhConfig.cpp b/src/coreclr/nativeaot/Runtime/RhConfig.cpp index 859899d25b0847..283fe09e3b8fd3 100644 --- a/src/coreclr/nativeaot/Runtime/RhConfig.cpp +++ b/src/coreclr/nativeaot/Runtime/RhConfig.cpp @@ -60,6 +60,8 @@ bool RhConfig::Environment::TryGetIntegerValue(const char* name, uint64_t* value if (!decimal && cchResult >= 2 && buffer[0] == '0' && (buffer[1] == 'x' || buffer[1] == 'X')) { startIndex = 2; + if (startIndex == cchResult) + return false; // parse error - hex prefix without any digits } for (uint32_t i = startIndex; i < cchResult; i++) {