Skip to content

Commit 1259b88

Browse files
committed
Fix buffer realloc issue
1 parent 2e95f15 commit 1259b88

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

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.16.12 - unreleased
4+
5+
- Fixed dump realloc bug that occurred when using the compat mode dump options.
6+
37
## 3.16.11 - 2025-05-29
48

59
- Fixed range encoding with the :circular option

ext/oj/dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ void oj_dump_cstr(const char *str, size_t cnt, bool is_sym, bool escape1, Out ou
10221022
char *cmap;
10231023
#ifdef HAVE_SIMD_NEON
10241024
uint8x16x4_t *cmap_neon = NULL;
1025-
int neon_table_size;
1025+
int neon_table_size = 0;
10261026
#endif /* HAVE_SIMD_NEON */
10271027
const char *orig = str;
10281028
bool has_hi = false;

ext/oj/dump_compat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ static void dump_array(VALUE a, int depth, Out out, bool as_ok) {
148148
} else {
149149
size = d2 * out->indent + 2;
150150
}
151-
assure_size(out, size * cnt);
152151
cnt--;
153152
for (i = 0; i <= cnt; i++) {
154153
if (out->opts->dump_opts.use) {
154+
assure_size(out, size);
155155
if (0 < out->opts->dump_opts.array_size) {
156156
APPEND_CHARS(out->cur, out->opts->dump_opts.array_nl, out->opts->dump_opts.array_size);
157157
}

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.16.11'
3+
VERSION = '3.16.12'
44
end

0 commit comments

Comments
 (0)