CVE-2026-79771: Ruby C Ext Stringvaluecstr Leak On Raise

Heap memory is allocated before calling `StringValueCStr` without exception protection. If `StringValueCStr` encounters null bytes or invalid types, it raises a Ruby exception via `longjmp`, skipping deallocation and leaking the allocated memory. Wrap the conversion in `rb_protect` or convert strings before allocating heap memory.

Provally CuratedPublic repositoryMediumHigh confidenceVerifiedApache-2.0C
greprules fetch cve-2026-79771-ruby-c-ext-stringvaluecstr-leak-on-raise --engine opengrep

Description

Heap memory is allocated before calling `StringValueCStr` without exception protection. If `StringValueCStr` encounters null bytes or invalid types, it raises a Ruby exception via `longjmp`, skipping deallocation and leaking the allocated memory. Wrap the conversion in `rb_protect` or convert strings before allocating heap memory.