-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
check for embedded NUL char in jl_load (for include) #16233
Conversation
@@ -4,6 +4,8 @@ using Base.Test | |||
|
|||
@test @__LINE__ == 5 | |||
|
|||
@test_throws ArgumentError include("test_sourcepath.jl\0") |
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 just call Core.include directly here? Otherwise, include_from_node1 is confusing the tests.
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.
Okay.
@@ -731,6 +731,7 @@ jl_value_t *jl_parse_eval_all(const char *fname, size_t len, | |||
fl_free_gc_handles(fl_ctx, 1); | |||
} | |||
else { | |||
assert(memchr(fname, 0, len) == NULL); // was checked already in jl_load |
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.
On release-0.4, jl-parse-file
is used inside jl_start_parsing_file
which does not take the len
as input. Could you propose a backported version, preferably w.r.t. tk/backports-0.4.6
if you want to get this in?
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.
FWIW, these functions should not take a length argument since they really don't support anything other than NUL terminated strings....
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.
bump again, would need assistance to resolve the conflict if you want this on release-0.4
This fixes a bug I noticed in #16218, in which
include("foo.jl\0")
would erroneously succeed if"foo.jl"
existed, because the filename would be silently truncated at the NUL char (similar to #10991).I did an audit of the other functions in
src/*.h
, and I couldn't find any other problems of this kind.