Skip to content

Commit

Permalink
apacheGH-40276: [C++] Fix an simple buffer-overflow case in decimal_b…
Browse files Browse the repository at this point in the history
…enchmark (apache#40277)

### Rationale for this change
An simple buffer-overflow case found in decimal_benchmark.

### What changes are included in this PR?
Change the loop len from `100` to correct `kValueSize`.

### Are these changes tested?

### Are there any user-facing changes?
No

* GitHub Issue: apache#40276

Authored-by: hugo.zhang <hugo.zhang@openpie.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
ZhangHuiGui authored and zanmato1984 committed Feb 28, 2024
1 parent a9b7d02 commit 118c93e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/decimal_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static void BinaryMathOpAggregate(

for (auto _ : state) {
BasicDecimal128 result;
for (int x = 0; x < 100; x++) {
for (int x = 0; x < kValueSize; x++) {
result += v[x];
}
benchmark::DoNotOptimize(result);
Expand Down

0 comments on commit 118c93e

Please sign in to comment.