Jens Geyer created THRIFT-6307:
----------------------------------

             Summary: Strengthen the wire-length size-limit tests (assert the 
error and the requested byte count)
                 Key: THRIFT-6307
                 URL: https://issues.apache.org/jira/browse/THRIFT-6307
             Project: Thrift
          Issue Type: Test
          Components: D - Library, JavaME - Library, Lua - Library, Smalltalk - 
Library
            Reporter: Jens Geyer
             Fix For: 0.26.0


h2. Background

The checks on wire-declared lengths in several bindings are covered by tests 
that assert only that _something_ was raised. That also passes on code that 
never enforced a bound, so the tests do not actually pin the behaviour they 
cover.

h2. Items

* Assert the specific error type/code, not merely that an error occurred (Lua, 
Java ME, D).
* Assert the number of bytes requested from the transport: a bounded reader 
requests at most the cap, an unbounded one requests the full declared size. 
This is the assertion that actually distinguishes the two. The Smalltalk suite 
already does this and is a good model.
* Add boundary cases: {{size == limit}} is accepted and {{limit + 1}} is 
rejected.
* Lua: the size-limit test uses Lua 5.3+ bitwise operators ({{|}}, {{&}}, 
{{~}}, {{<<}}, {{>>}}), which fail to _parse_ on Lua 5.1/5.2 and can break the 
whole suite on those runtimes. Use a 5.1-compatible construction.
* Lua: {{time_read_all}} is timing-based and can be flaky under load.

_Drafted with AI assistance (Claude Opus 4.8); reviewed and filed by Jens 
Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to