Make next_token static - #143
Closed
kavyabhand wants to merge 1 commit into
Closed
Conversation
next_token was the only internal helper without static and is not in tinyexpr.h. Linking against another TU that defines next_token can silently bind the wrong function under --allow-multiple-definition or LD_PRELOAD. Fixes accidental export; see issue discussion.
There was a problem hiding this comment.
Pull request overview
This PR fixes an accidental symbol export by giving the internal lexer helper next_token internal linkage (static), preventing external symbol interposition/collisions that can break expression parsing at runtime.
Changes:
- Changed
next_token(state *s)from external linkage tostaticintinyexpr.cto ensure it is not exported as a global symbol.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
Fixed, thank you. |
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
Marks
next_tokenstatic. It is an internal lexer helper, absent fromtinyexpr.h, but was accidentally exported.Why
See #141. With
-Wl,--allow-multiple-definitionorLD_PRELOAD, a collidingnext_tokencan be called instead of the lexer, andte_interp("1+2")returns a parse error instead of3.Test plan
make smoke/make smoke_prnm -g --defined-only tinyexpr.ono longer listsnext_token