Skip to content

string constructor fails to catch length error at edge case #16

@ongjunjie

Description

@ongjunjie

The following code segfaults

#define EASTL_EXCEPTIONS_ENABLED 1
#include <EASTL/string.h>

int main() {
    try {
        eastl::string( size_t(-1), 'a' );
    } catch( const std::length_error& ) {
    }
    return 0;
}

void* operator new[] (size_t size, const char*, int, unsigned, const char*, int)
{
    return (void*)::new char[size];
}

void* operator new[] (size_t size, size_t, size_t, const char*, int, unsigned, const char*, int)
{
    return (void*)::new char[size];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions