Skip to content

normalize_path triggers assertion in boost 1.91 #992

@jeremiahar

Description

@jeremiahar

The following code asserts starting in boost 1.91.0:

#include <boost/url/url.hpp>
#include <iostream>

int main(int argc, char **argv)
{
    boost::system::result<boost::urls::url_view> parse_result = boost::urls::parse_origin_form("//");
    if (!parse_result)
        return 1;
    boost::urls::url url(parse_result.value());
    url.normalize();

    std::cout << url << std::endl;
    return 0;
}
main: /opt/boost_1_91/include/boost/url/impl/url_base.hpp:2207: boost::urls::url_base& boost::urls::url_base::normalize_path(): Assertion `n + 2 <= pn' failed.

It can probably be simplified a little, but this is how I originally ran into the issue. It will buffer overflow when assertions are disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions