-
Notifications
You must be signed in to change notification settings - Fork 171
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
elf_parser fails loading a valid ELF file #532
Comments
It is invalid because it contains a section name longer than 16 bytes: |
The error message reports invalid string. This has to be fixed. Also a test case must be added, that checks the correct error reporting. |
Please don’t close issues that I open until I confirm that it is resolved. |
Roger, What other error message would you expect? It is an invalid string after all. Or do you want a separate |
It’s not an invalid string. in this case the error message must inform that a section name is over the length limit and indicate which section it is. The string that it breaks on is not even the one of the section name. Fix this. |
Not saying it can't be done but it is tricky, hence we haven't implemented it yet. |
backtrace after applyhing the patch diff --git a/tests/execution.rs b/tests/execution.rs
index bb2f9a9..5102e06 100644
--- a/tests/execution.rs
+++ b/tests/execution.rs
@@ -2206,6 +2206,17 @@ fn test_relative_call() {
);
}
+#[test]
+fn test_sample() {
+ test_interpreter_and_jit_elf!(
+ "tests/elfs/sample.so",
+ [1],
+ (),
+ TestContextObject::new(18),
+ ProgramResult::Ok(3),
+ );
+}
+ and
|
Reporting a more meaningful error (not the obscured "invalid string") definitely doesn't require any of "parsing with a much longer zero-termination-search", "parse the UTF-8", or "heap allocation". Even if the error includes the first 16 characters of the section name, it would be sufficient (no heap allocation needed, even though using heap allocation as an excuse for improper error reporting is non-withstanding). Finally, the current tests do not test the elf_parser on any ELF files that would be rejected. This is simply unacceptable. |
Addresses: #532 Co-authored-by: Aditya K <1894981+hiraditya@users.noreply.github.com>
The new elf parser breaks on a valid ELF input file. The file is attached in this issue.
sample.ZIP
The text was updated successfully, but these errors were encountered: