Skip to content

Vector overrun #76

Open
Open
@danijel3

Description

@danijel3

This piece of code causes a crash when compiled in Visual Studio C++:

vector<int> subv (&word[i], &word[i+j]);

Interestingly, it seems to work under Linux. In any case, this is a little iffy approach, since referencing the brackets operator beyond the vector is generally incorrect, even if it is only used as a last iterator in this case. A fix for this line is to simply use:

vector<int> subv (word.begin()+i, word.begin()+i+j); 

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