Skip to content

Commit 3650e2b

Browse files
mameclaude
authored andcommitted
Document that JSON::ResumableParser does not bound its buffer size
An incomplete document is buffered in full with no size limit, so reading from an untrusted source can grow memory without bound. Note in the rdoc that bounding the input is the caller's responsibility. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 65549ac commit 3650e2b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ext/json/ext/parser/parser.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,6 +2268,11 @@ static inline JSON_ResumableParser *cResumableParser_get(VALUE self)
22682268
* parser << ' '
22692269
* parser.parse # => true
22702270
* parser.value # => 123
2271+
*
2272+
* === Security
2273+
*
2274+
* An incomplete document is buffered in full and there is no size limit, so when reading
2275+
* from an untrusted source the caller is responsible for bounding how much data is fed.
22712276
*/
22722277
static VALUE cResumableParser_initialize(int argc, VALUE *argv, VALUE self)
22732278
{

0 commit comments

Comments
 (0)