Repository navigation
fix: guard missing embedding environment variables - #369
Open
philippedev101 wants to merge 1 commit into
Open
philippedev101 wants to merge 1 commit into
philippedev101 wants to merge 1 commit into
Conversation
Check getenv() results in embedding/embedding.cpp before passing them to atoi(), std::string(), JS_GetProperty(), or indexing arg_tys[0]. Optional DEBUG and FEATURE_CLOCKS flags now default to disabled when unset, missing Wizer binding metadata reports FnList, TypeParse, or install() failure instead of dereferencing null pointers, and call() asserts argptr is non-null before decoding scalar arguments.
philippedev101
requested review from
andreiltd,
tschneidereit and
vados-cosmonic
as code owners
December 2, 2026 15:57
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.
Unset Wizer environment variables currently trigger null-pointer dereferences or
atoi(nullptr)UB inembedding/embedding.cpp. With these guards, omitting optional flags works cleanly, missing binding metadata returns structured initialization errors instead of trapping, and the embedding passes Clang Static Analyzer with zero warnings.In
componentize_initialize(), unsetDEBUGandFEATURE_CLOCKSnow leave those features disabled. MissingEXPORT_CNTorEXPORT*_NAMEreturnsFnList, and missingEXPORT*_ARGS,EXPORT*_RET, orEXPORT*_RETSIZEreturnsTypeParse. Ininstall(), missingSOURCE_NAME,IMPORT_CNT,IMPORT*_NAME, orIMPORT*_ARGCNTnow returnsfalse.In
call(), the scalar argument path now assertsMOZ_RELEASE_ASSERT(argptr)before reading the buffer, matching the nullability assumption on line 186.Checked with
clang++ --analyze(0 diagnostics), Wizer runs omitting each of the eleven env vars, andnpm run test:release(79 passed, 1 skipped).