RubySec

Providing security resources for the Ruby community

CVE-2026-54900 (oj): Oj - Negative-Size memcpy in 'Oj::Parser' create_id Attribute Handling

Oj - Negative-Size memcpy in 'Oj::Parser' create_id Attribute Handling

Published: June 19, 2026

SECURITY IDENTIFIERS

GEM

oj

PATCHED VERSIONS

>= 3.17.3

DESCRIPTION

Summary

Oj::Parser#parse in usual mode with create_id enabled is vulnerable to heap corruption via a negative-size memcpy. When a JSON object key is exactly 65,535 bytes long, an integer truncation in form_attr (usual.c:63) converts the length to -1 before passing it to memcpy. This causes memcpy to copy SIZE_MAX bytes (interpreted as a huge size_t), corrupting heap memory and crashing the process.

RELATED