Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vector default constructor can only lead to SEG-faults #164

Open
willGraham01 opened this issue Nov 3, 2022 · 0 comments
Open

Vector default constructor can only lead to SEG-faults #164

willGraham01 opened this issue Nov 3, 2022 · 0 comments

Comments

@willGraham01
Copy link
Collaborator

willGraham01 commented Nov 3, 2022

Vector class is declared in arrays.h

Vectors can be created without assigning their elements, IE the attribute Vector.vector can be nullptr if one uses the default constructor.

This can potentially lead to seg faults, since one could then run

Vector<double> v;
v[0];

What is particularly odd is that once created, Vector has no method to assign (or reassign) a valid block of memory to vector.

As such, it doesn't seem to make sense as to why we should allow creation of this object in this way. The default constructor for Vector should be removed, and the classes that have Vector attributes should be checked over for similar issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant