[pull] master from mruby:master#185
Merged
pull[bot] merged 16 commits intosysfce2:masterfrom Feb 10, 2026
Merged
Conversation
Replace per-symbol mrb_malloc() with a chunk-based string pool that batches allocations into 4KB chunks. This reduces malloc call count by ~12x (e.g. 909 vs 10,887 for 10k dynamic symbols) and eliminates per-allocation malloc metadata overhead (~16 bytes/symbol). Pool allocations are rounded up to even size to preserve LSB pointer tagging used for literal detection. Co-authored-by: Claude <noreply@anthropic.com>
Automatically detect terminal background color using OSC 11 escape sequence to select appropriate syntax highlighting theme (dark/light). Detection priority: MIRB_THEME env > OSC 11 > COLORFGBG env > dark default. Co-authored-by: Claude <noreply@anthropic.com>
Result values are shown in cyan, errors in bold red. The arrow " => " uses gray for subtle appearance. Co-authored-by: Claude <noreply@anthropic.com>
Use syntax highlighter for result values instead of single color.
Add support for hash key symbol syntax (e.g., `a:` in `{a: 1}`).
Co-authored-by: Claude <noreply@anthropic.com>
mpz_mul_sparse allocated temporary mpz_t variables (shifted, temp) that were leaked when an exception was raised (e.g., RangeError from shift width too large). bint_mul had the same issue with its output mpz_t z. Wrap both functions with MRB_ENSURE to guarantee cleanup runs regardless of exceptions, following the existing pattern used by mpz_mul_all_ones. Co-authored-by: Claude <noreply@anthropic.com>
The work buffer size in mpz_montgomery_reduce() was calculated as x_len + k + 2, which assumed x_len >= k. However, when R^2 mod n produces a small result, x_len can be much smaller than k. The Montgomery reduction loop writes k limbs at work[i] for each iteration i=0..k-1, so the maximum index accessed is work[2k-1]. This requires at least 2k limbs in the work buffer. Fixed by ensuring work_size is at least 2*k+2 limbs when x_len < k. Also initialize b->as.heap before mpz_move in bint_set() to ensure the destination mpz_t has valid initial state. Co-authored-by: Claude <noreply@anthropic.com>
Barrett and Montgomery reduction compute 2^(2k) internally where k is the modulus bit length. When this exceeds MRB_BIGINT_BIT_LIMIT, mrb_raise() via longjmp skips cleanup of allocated temporaries. Add early modulus size check before any heap allocation. Co-authored-by: Claude <noreply@anthropic.com>
The JMPNOT-to-JMPIF optimization in NODE_PAT_ALT assumed the fail chain always ends with OP_JMPNOT (format BS), but NODE_PAT_PIN generates OP_JMP (format S) when the pinned variable is undefined. Writing OP_JMPIF at left_fail-2 then corrupts the preceding instruction's operand, causing out-of-bounds pool access at runtime. Co-authored-by: Claude <noreply@anthropic.com>
CRuby raises SyntaxError for `^a` in pattern matching when `a` is not a local variable. Previously mruby silently generated an unconditional fail jump, which also led to bytecode corruption when combined with alternation patterns. Co-authored-by: Claude <noreply@anthropic.com>
Reject MRB_INT_MAX length strings to prevent signed integer overflow when adding 1 for the null terminator in str_init_normal_capa() and resize_capa(). Co-authored-by: Claude <noreply@anthropic.com>
…egen The MATCHERR optimization replaced JMPNOT (BS, 4 bytes) with MATCHERR (B, 2 bytes) and rewound s->pc by 2. When pattern alternation (e.g. a|B) dispatched a success jump to s->pc before the optimization, the rewind shifted subsequent instructions and the jump landed in the middle of the next instruction, causing out-of-bounds access at runtime. Replace JMPNOT in-place with MATCHERR+NOP+NOP to keep the same 4-byte size, so s->pc does not change and jump targets stay valid. Co-authored-by: Claude <noreply@anthropic.com>
prek is a faster, Rust-based drop-in replacement for pre-commit. It reads the same .pre-commit-config.yaml with no changes needed. Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
The bounds check for IREP_TT_STR pool data only validated pool_data_len bytes, but the binary format includes a null terminator after the string content. Both memcpy and the source pointer advance by pool_data_len+1, so the check must account for the extra byte. Co-authored-by: Claude <noreply@anthropic.com>
Same issue as the pool string fix: the bounds check for symbol names only validated snl bytes, but the binary format includes a null terminator. The source pointer advances by snl+1, so the check must account for it. Co-authored-by: Claude <noreply@anthropic.com>
Zero-initialize the mirb_editor struct to prevent highlight.enabled from containing garbage values when stdin is not a tty (e.g. in bintest). Without this, ANSI color codes could be emitted in non-interactive mode, breaking output string matching in tests. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )