Fix off-by-one error in ASM Encoder#8637
Conversation
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8637) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (73ms) : 70, 76
master - mean (74ms) : 70, 79
section Bailout
This PR (8637) - mean (77ms) : 75, 79
master - mean (78ms) : 74, 81
section CallTarget+Inlining+NGEN
This PR (8637) - mean (1,104ms) : 1060, 1149
master - mean (1,100ms) : 1043, 1157
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (112ms) : 109, 116
master - mean (115ms) : 110, 119
section Bailout
This PR (8637) - mean (117ms) : 110, 124
master - mean (115ms) : 111, 118
section CallTarget+Inlining+NGEN
This PR (8637) - mean (789ms) : 769, 809
master - mean (787ms) : 758, 816
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (101ms) : 97, 105
master - mean (104ms) : 98, 109
section Bailout
This PR (8637) - mean (102ms) : 99, 104
master - mean (103ms) : 99, 106
section CallTarget+Inlining+NGEN
This PR (8637) - mean (947ms) : 912, 981
master - mean (945ms) : 904, 986
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (103ms) : 97, 109
master - mean (98ms) : 95, 102
section Bailout
This PR (8637) - mean (106ms) : 103, 109
master - mean (101ms) : 97, 105
section CallTarget+Inlining+NGEN
This PR (8637) - mean (827ms) : 788, 865
master - mean (819ms) : 774, 865
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (198ms) : 191, 206
master - mean (199ms) : 195, 204
section Bailout
This PR (8637) - mean (203ms) : 198, 207
master - mean (202ms) : 197, 206
section CallTarget+Inlining+NGEN
This PR (8637) - mean (1,200ms) : 1140, 1260
master - mean (1,204ms) : 1154, 1253
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (285ms) : 276, 294
master - mean (289ms) : 278, 299
section Bailout
This PR (8637) - mean (285ms) : 277, 294
master - mean (290ms) : 281, 298
section CallTarget+Inlining+NGEN
This PR (8637) - mean (955ms) : 931, 979
master - mean (965ms) : 948, 982
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (278ms) : 273, 284
master - mean (281ms) : 273, 289
section Bailout
This PR (8637) - mean (278ms) : 273, 283
master - mean (281ms) : 274, 289
section CallTarget+Inlining+NGEN
This PR (8637) - mean (1,160ms) : 1123, 1196
master - mean (1,170ms) : 1132, 1208
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8637) - mean (278ms) : 272, 285
master - mean (278ms) : 271, 285
section Bailout
This PR (8637) - mean (277ms) : 272, 282
master - mean (279ms) : 271, 286
section CallTarget+Inlining+NGEN
This PR (8637) - mean (1,037ms) : 990, 1085
master - mean (1,039ms) : 993, 1084
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-05-15 09:18:55 Comparing candidate commit 4091ae5 in PR branch Some scenarios are present only in baseline or only in candidate runs. If you didn't create or remove some scenarios in your branch, this maybe a sign of crashed benchmarks 💥💥💥 Scenarios present only in baseline:
Found 5 performance improvements and 2 performance regressions! Performance is the same for 50 metrics, 15 unstable metrics, 88 known flaky benchmarks, 38 flaky benchmarks without significant changes.
|
| foreach (var val in enumerable) | ||
| { | ||
| if (idx > childrenCount) | ||
| if (idx >= childrenCount) |
There was a problem hiding this comment.
I would say that this fixes a bug that could be serious especially in an unsafe context. idx could keep climbing past childrenCount and write past the end of childrenData, right?
Summary of changes
Fix off-by-one error in the
Encoderwhen encoding anIEnumerablethat doesn't implementIListReason for change
There's an off by one error in the encoder
Implementation details
Test coverage
Added a unit test to demonstrate the error and fix it.
Note that the legacy encoder's switch has no
IEnumerable<object>case, it falls through toEncodeUnknownType(which just calls.ToString()), so the tests are skipped for that case.