Either argv[1] is not null-terminated, which allows the std::string constructor to read past the end, or the heap has been corrupted somewhere else, which causes the memory allocation to fail.
Ok, if it's not null terminated by default, then that's the problem. And if it's not I guess I cant just add a 0 to it because the argv is not greater than its content?
Oh, wait. I know. If you don't pass any arguments to the program and don't check argc, you're reading outsize the bounds of argv. argv[1] is not a valid pointer.