Skip to content

Commit bbde91a

Browse files
authored
Fix intern.c and fast.c (#1015)
* Fix intern.c and fast.c * Update changelog * clang-format
1 parent 495cc38 commit bbde91a

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 3.17.3 - 2026-06-04
4+
5+
- Fixed issue in intern.c and fast.c.
6+
37
## 3.17.2 - 2026-05-27
48

59
- Fixed multiple issues related to extreme sizes.

ext/oj/fast.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,9 @@ static VALUE doc_each_child(int argc, VALUE *argv, VALUE self) {
15041504
Leaf first = (*doc->where)->elements->next;
15051505
Leaf e = first;
15061506

1507+
if (MAX_STACK <= (doc->where + 1) - doc->where_path) {
1508+
rb_raise(rb_const_get_at(Oj, rb_intern("DepthError")), "Path too deep. Limit is %d levels.", MAX_STACK);
1509+
}
15071510
doc->where++;
15081511
do {
15091512
*doc->where = e;
@@ -1513,6 +1516,7 @@ static VALUE doc_each_child(int argc, VALUE *argv, VALUE self) {
15131516
}
15141517
e = e->next;
15151518
} while (e != first);
1519+
doc->where--;
15161520
}
15171521
if (0 < wlen) {
15181522
memcpy(doc->where_path, save_path, sizeof(Leaf) * (wlen + 1));

ext/oj/intern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static VALUE form_attr(const char *str, size_t len) {
6969
memcpy(b + 1, str, len);
7070
b[len + 1] = '\0';
7171
}
72-
id = rb_intern3(buf, len + 1, oj_utf8_encoding);
72+
id = rb_intern3(b, len + 1, oj_utf8_encoding);
7373
OJ_R_FREE(b);
7474
return id;
7575
}

lib/oj/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module Oj
22
# Current version of the module.
3-
VERSION = '3.17.2'
3+
VERSION = '3.17.3'
44
end

0 commit comments

Comments
 (0)