Skip to content

Disallow unbalanced bidirectional unicode in strings and comments #242

Closed
@c42f

Description

@c42f

The reference parser disallows bidirectional formatting to prevent certain types of malicious code. From Julia's test/syntax.jl:

@test_throws ParseError Meta.parse("""
function checkUserAccess(u::User)
	if u.accessLevel != "user\u202e \u2066# users are not allowed\u2069\u2066"
		return true
	end
	return false
end
""")

@test_throws ParseError Meta.parse("""
function checkUserAccess(u::User)
	#=\u202e \u2066if (u.isAdmin)\u2069 \u2066 begin admins only =#
		return true
	#= end admin only \u202e \u2066end\u2069 \u2066=#
	return false
end
""")

This needs to be fixed in the tokenizer

See also the fix in the reference parser:
JuliaLang/julia#42918

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions