-
Notifications
You must be signed in to change notification settings - Fork 13.3k
dladdr cannot leave dli_fname to be null #141239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
rustbot has assigned @compiler-errors. Use |
The Miri subtree was changed cc @rust-lang/miri |
@@ -92,8 +92,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> { | |||
fn get_func_ptr_explicitly_from_lib(&mut self, link_name: Symbol) -> Option<CodePtr> { | |||
let this = self.eval_context_mut(); | |||
// Try getting the function from the shared library. | |||
// On windows `_lib_path` will be unused, hence the name starting with `_`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment was outdated, the entire module does not even get built on Windows.
@bors r+ |
Rollup of 5 pull requests Successful merges: - rust-lang#140847 (coverage: Detect unused local file IDs to avoid an LLVM assertion) - rust-lang#141117 (opt-dist: fix deprecated BOLT -icf=1 option) - rust-lang#141225 (more ice tests) - rust-lang#141239 (dladdr cannot leave dli_fname to be null) - rust-lang#141242 (in `tests/ui/asm/aarch64/parse-error.rs`, only test cases specific to that target) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#141239 - RalfJung:dladdr-fname, r=Noratrieb dladdr cannot leave dli_fname to be null There are two places in the repo calling `dladdr`, and they are inconsistent wrt their assumption of whether the `dli_fname` field can be null. Let's make them consistent. I see nothing in the docs that allows it to be null, but just to be on the safe side let's make this an assertion so hopefully we get a report if that ever happens.
if info.dli_fname.is_null() { | ||
return Err("dladdr returned null pointer".into()); | ||
} | ||
assert!(!info.dli_fname.is_null(), "the docs do not allow dladdr to be null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "do not allow dli_fname to be null" ? as you pointed out, dladdr can return 0, and dli_sname
can be null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops
There are two places in the repo calling
dladdr
, and they are inconsistent wrt their assumption of whether thedli_fname
field can be null. Let's make them consistent. I see nothing in the docs that allows it to be null, but just to be on the safe side let's make this an assertion so hopefully we get a report if that ever happens.