Jens Geyer created THRIFT-6033:
----------------------------------
Summary: Harden Swift protocol negative sizes
Key: THRIFT-6033
URL: https://issues.apache.org/jira/browse/THRIFT-6033
Project: Thrift
Issue Type: Bug
Components: Swift - Library
Reporter: Jens Geyer
The Swift library does not validate negative sizes when reading Thrift payloads.
Size values appear in binary/string fields and in map/list/set headers. Those
values must be non-negative. In {{TBinaryProtocol.swift}}, the
{{readMapBegin}}, {{readListBegin}}, {{readSetBegin}}, and {{readStringBody}}
methods read a size and use it without any negative check.
Note: the existing {{size < 0}} check in {{readMessageBegin}} is for protocol
version detection (old-style message framing), not size validation.
This is a protocol hardening gap compared with other runtimes such as C++,
Java, Python, Go, and Node.js, which all raise a NEGATIVE_SIZE exception.
The fix should add negative-size checks that throw a TProtocolError in all
container and string/binary read paths.
See THRIFT-6025 for the equivalent Ruby fix.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)