Skip to content
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

Invalid string construction #57133

Open
PJBoy opened this issue Feb 19, 2025 · 3 comments · May be fixed by #57141
Open

Invalid string construction #57133

PJBoy opened this issue Feb 19, 2025 · 3 comments · May be fixed by #57141
Labels
confirmed-bug Issues with confirmed bugs.

Comments

@PJBoy
Copy link

PJBoy commented Feb 19, 2025

return ThrowInvalidURL(realm->env(), input.ToStringView(), nullptr);

ThrowInvalidURL takes an std::optional<std::string> as third parameter. Passing nullptr constructs a std::string from that null pointer, this is undefined behaviour (upgraded to ill-formed in C++23). At a glance, it would seem that std::nullopt was the intended third argument.

@anonrig
Copy link
Member

anonrig commented Feb 19, 2025

Correct. Contributions are welcome.

@anonrig anonrig added the confirmed-bug Issues with confirmed bugs. label Feb 19, 2025
@geeksilva97
Copy link
Contributor

geeksilva97 commented Feb 19, 2025

Would the change be like this

- return ThrowInvalidURL(realm->env(), input.ToStringView(), nullptr); 
+ return ThrowInvalidURL(realm->env(), input.ToStringView(), std::nullopt); 

If so, could this issue be a good first issue?

@danielmbrasil
Copy link

Hey, I'd like to take this on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants