kpumuk opened a new pull request, #3710: URL: https://github.com/apache/thrift/pull/3710
<!-- Explain the changes in the pull request below: --> Ruby’s pure and native CompactProtocol readers accept fifth-byte varint payload bits outside the uint32 range, and they produce different values for the same input. Binary length prefixes above the signed int32 size domain are also passed to the transport instead of being rejected by the protocol. This change gives both readers the same boundary behavior. Invalid fifth-byte payload bits now raise `ProtocolException::INVALID_DATA`, while binary lengths above `INT32_MAX` raise `ProtocolException::SIZE_LIMIT` before `read_all` is called. Valid uint32 varints, signed i32 values, binary sizes through `INT32_MAX`, and ordinary Compact messages remain supported. ## Benchmarks I ran the repository’s small Compact read benchmark against current master (`c2def39207a73394420088da9b4b105571dd9036`) and this change in the same Ruby container: ```console ruby test/rb/benchmarks/protocol_benchmark.rb --json --small-runs 10000 --scenarios rb-cmp-read-small THRIFT_BENCHMARK_SKIP_NATIVE=1 ruby test/rb/benchmarks/protocol_benchmark.rb --json --small-runs 10000 --scenarios rb-cmp-read-small ``` Each result is the median of 11 independent warmed runs. | Mode | Master median (range) | Proposed median (range) | Delta | | --- | ---: | ---: | ---: | | Native extension | 0.051075 s (0.049545–0.053581) | 0.052138 s (0.050545–0.054560) | +2.08% | | Pure Ruby | 0.180099 s (0.173008–0.235398) | 0.177465 s (0.174482–0.180574) | -1.46% | The ranges overlap. This focused small-structure read workload does not show a clear performance change. <!-- We recommend you review the checklist/tips before submitting a pull request. --> - [x] Did you create an [Apache Jira](https://issues.apache.org/jira/browse/THRIFT-6145) ticket? ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes) - [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"? - [x] Did you squash your changes to a single commit? (not required, but preferred) - [x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"? - [x] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources. <!-- The Contributing Guide at: https://github.com/apache/thrift/blob/master/CONTRIBUTING.md has more details and tips for committing properly. --> -- 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]
