check wire-supplied size in simple json ReadMapBegin#3599
Conversation
|
Did you look at list/set as well? |
Code reviewFound 1 issue:
Lines 89 to 95 in 983c813 Validation: list/set and other protocols The same class of bug (
The bug is isolated to 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Client: go Companion to THRIFT-6071 (same guard for ParseElemListBegin). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Checked: However, both |
TSimpleJSONProtocol.ReadMapBegin reads the map size off the wire into iSize, but the following checkSizeForProtocol call is passed int32(size) where size is the named return value that is still zero at that point, so the MaxMessageSize limit is always tested against 0 and the real size is never bounded before it is returned. A peer can therefore declare an oversized map and have it slip past the configured limit, which then feeds the map preallocation in generated read code. The sibling ParseElemListBegin used for lists and sets already validates the value it read off the wire, so this just points the map check at iSize to match it.