LiangliangSui opened a new pull request, #2961: URL: https://github.com/apache/fory/pull/2961
<!-- **Thanks for contributing to Apache Fory™.** **If this is your first time opening a PR on fory, you can refer to [CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md).** Contribution Checklist - The **Apache Fory™** community has requirements on the naming of pr titles. You can also find instructions in [CONTRIBUTING.md](https://github.com/apache/fory/blob/main/CONTRIBUTING.md). - Apache Fory™ has a strong focus on performance. If the PR you submit will have an impact on performance, please benchmark it first and provide the benchmark result here. --> ## Why? <!-- Describe the purpose of this PR. --> Fix the abnormal data type judgment in CPP buffer.h (std::numeric_limits<int>::max()). ## What does this PR do? <!-- Describe the details of this PR. --> run ```bash cd benchmarks/cpp_benchmark ./profile.sh --duration 10 --filter BM_Fory_Struct_Serialize ``` Got the following error: ``` === Fory C++ Benchmark Profiler === Filter: BM_Fory_Struct_Serialize Duration: 10s Output: profile_output Profiling with samply... Running: samply record ./fory_benchmark --benchmark_min_time=10s --benchmark_filter=BM_Fory_Struct_Serialize Unable to determine clock rate from sysctl: hw.cpufrequency: No such file or directory This does not affect benchmark measurements, only the metadata output. ***WARNING*** Failed to set thread affinity. Estimated CPU frequency may be incorrect. 2025-12-02T16:23:03+08:00 Running ./fory_benchmark Run on (10 X 24 MHz CPU s) CPU Caches: L1 Data 64 KiB L1 Instruction 128 KiB L2 Unified 4096 KiB (x10) Load Average: 2.09, 2.23, 2.36 [2025-12-02 16:23:11,944] FATAL fory/cpp/fory/util/buffer.h:86: Check failed: writer_index < std::numeric_limits<int>::max() Buffer overflow writer_index2147483646 diff 1 *** StackTrace Information *** fory::GetCallTrace() fory::ForyLog::~ForyLog() fory::serialization::Serializer<>::write() fory::serialization::Fory::serialize_impl<>() BM_Fory_Struct_Serialize() benchmark::internal::BenchmarkInstance::Run() benchmark::internal::(anonymous namespace)::RunInThread() benchmark::internal::BenchmarkRunner::DoNIterations() benchmark::internal::BenchmarkRunner::DoOneRepetition() benchmark::RunSpecifiedBenchmarks() benchmark::RunSpecifiedBenchmarks() main start ``` In `buffer.h`, `writer_index_` and `reader_index_` are of the `uint32_t` type. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
