Fix SEGV on MIPS machines (#1310)

This commit is contained in:
Tim Wilkinson 2024-08-18 11:55:02 -07:00 committed by GitHub
parent efb6631531
commit 4c57f60570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@
+ if (ucv_type(val) == UC_STRING) {
+- out_len = convert(out_buf, sizeof(out_buf),
++ out_buf_len = ucv_string_length(val) * scale;
++ out_buf = (char *)alloca(out_buf_len);
++ out_buf = (char *)alloca(out_buf_len + 1);
++ out_len = convert(out_buf, out_buf_len,
+ ucv_string_get(val), ucv_string_length(val));
+ }
@ -28,7 +28,7 @@
+ p = ucv_to_string(vm, val);
+- out_len = p ? convert(out_buf, sizeof(out_buf), p, strlen(p)) : 0;
++ out_buf_len = strlen(p) * scale;
++ out_buf = (char *)alloca(out_buf_len);
++ out_buf = (char *)alloca(out_buf_len + 1);
++ out_len = p ? convert(out_buf, out_buf_len, p, strlen(p)) : 0;
+ free(p);
+ }