Skip to content

Commit ce2f5e1

Browse files
committed
Check for error on rb_yajl_projector_build_string
1 parent bef7072 commit ce2f5e1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ext/yajl/yajl_ext.c

+3
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,9 @@ static VALUE rb_yajl_projector_build_string(yajl_event_stream_t parser, yajl_eve
949949

950950
yajl_buf strBuf = yajl_buf_alloc(parser->funcs);
951951
yajl_string_decode(strBuf, (const unsigned char *)event.buf, event.len);
952+
if (yajl_buf_err(strBuf)) {
953+
rb_raise(cParseError, "YAJL internal error: failed to allocate memory");
954+
}
952955

953956
VALUE str = rb_str_new((const char *)yajl_buf_data(strBuf), yajl_buf_len(strBuf));
954957
rb_enc_associate(str, utf8Encoding);

0 commit comments

Comments
 (0)