Repository navigation
Conversation
Without returning after the error, execution fell through and returned compiler->fn->constants.count - 1, which could emit invalid bytecode.
cuiweixie
force-pushed
the
fix/addconstant-return-on-max-constants
branch
from
March 27, 2026 06:12
60c7cc9 to
df29737
Compare
TaxMachine
pushed a commit
to TaxMachine/wren
that referenced
this pull request
Oct 11, 2026
Base: upstream wren-lang/wren @ 99d2f0b (fork main), tree previously vendored as a depth-1 clone with .git stripped. Delta (10 files, all in src/vm/): security backports of upstream PRs wren-lang#1242-1246 (OOB/BOF clamps), fixes for wren-lang#1234 (runtimeError upvalue leak), wren-lang#1212 (lazy string hashing), wren-lang#1141 (sort middle pivot), wren-lang#1056 (cyclic-print truncation), wren-lang#676 (createForeign stackTop), wren-lang#1036/wren-lang#1034/ wren-lang#1033 (error-message bounds), wren-lang#811 (unbound foreign ctor), wren-lang#1236 (fiber-stack UAF), wren-lang#1230 (String.find table), wren-lang#1088 (upvalue bound), wren-lang#1102 (Range.contains), wren-lang#1228 (lexer overrun), wren-lang#814 (hex-escape UB), wren-lang#897 (shift UB), wren-lang#1232/wren-lang#1233 (fromString/u64), wren-lang#803 (any/all Bool), wren-lang#1000 (error hygiene), wren-lang#1012/wren-lang#1068 (warning hygiene), wren-lang#1231/wren-lang#1229 (error-path consistency), plus feurhax hardening (GC-rooted attribute copy, MAX_NEST_DEPTH=512 parser cap, call-handle arity clamp) and the 64MB heap-cap / perf-audit follow-ups. Full per-fix archaeology lives in the consumer tree at feurhax-client/third_party/VENDORED.md (wren section). Built with WREN_OPT_META=0 WREN_OPT_RANDOM=0; scripting_test + script_editor_test green.
This branch has not been deployed
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
In
addConstant, whenMAX_CONSTANTSis exceeded we callerror()but previously did not return. Execution then fell through toreturn compiler->fn->constants.count - 1, which could emit bytecode with a bogus constant index.Return
-1after reporting the error (consistent with other failure paths in the compiler).Testing