Skip to content

Invalid string construction #57133

Description

@PJBoy

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.

Activity

  1. anonrig commented on Feb 19, 2025

    @anonrig
    Member

    Correct. Contributions are welcome.

  2. geeksilva97 commented on Feb 19, 2025

    @geeksilva97
    Contributor

    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?

  3. danielmbrasil commented on Feb 19, 2025

    @danielmbrasil
    Contributor

    Hey, I'd like to take this on.

  4. Ali-Adel-Nour commented on Feb 22, 2025

    @Ali-Adel-Nour

    Can, I take this one if there is no objection?

  5. danielmbrasil commented on Feb 22, 2025

    @danielmbrasil
    Contributor

    Hey @Ali-Adel-Nour, there is an open PR addressing this issue already (#57141).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues and PRs for confirmed bugs.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions