Add required min_erts field #703
Merged
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.
Set
ErlNifEntry.min_erts
to a placeholder valueThis value was introduced with NIF version 2.14 (so, OTP-21, erts-10.0).
Us leaving it unassigned and defaulting to NIF version 2.15 means the OTP is currently always putting a random pointer into the respective field here:
https://github.com/erlang/otp/blob/ae81b2f6ff2d541c01242f12cdbd5238aa4b26bd/erts/emulator/beam/erl_nif.c#L4581-L4585
It is used if one tries to load a NIF library that was compiled for a newer NIF version to display a debug message, at which point it would perform an out-of-bounds read.
As we currently default to NIF v2.15 (OTP-22) and only have features up to 2.16 (OTP-24), there are probably very few cases of this actually occurring in the wild.