Jens Geyer created THRIFT-6306:
----------------------------------

             Summary: Lua: checkDeclaredSize raises a bare Lua error when the 
size limit is nil
                 Key: THRIFT-6306
                 URL: https://issues.apache.org/jira/browse/THRIFT-6306
             Project: Thrift
          Issue Type: Bug
          Components: Lua - Library
            Reporter: Jens Geyer
             Fix For: 0.26.0


h2. Problem

{{TTransportBase:checkDeclaredSize(size, limit)}} in {{lib/lua/TTransport.lua}} 
evaluates {{if size > limit then ...}}. When {{limit}} is {{nil}}, Lua raises a 
bare runtime error (_attempt to compare number with nil_) instead of a 
{{TTransportException}}, so the failure escapes the usual {{TException}} 
handling.

h2. Impact

Defensive only in normal use: callers inherit the base {{DEFAULT_MAX_SIZE}} (16 
MB), so {{limit}} is not normally {{nil}}. But as a shared base method it 
should degrade cleanly rather than throw a bare interpreter error.

h2. Suggested fix

Treat a {{nil}} {{limit}} as "no explicit maximum" (fall back to 
{{DEFAULT_MAX_SIZE}}, or skip only the upper-bound comparison while keeping the 
negative-size check), so the method always raises {{TTransportException}}.

_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