BigUglySpider / EmuLibs

Selection of libraries designed to be used with Emu projects. This was originally a Math library only, but has since been changed to hold all Emu libraries to enable consistency in changes to dependencies (such as EmuCore modifications).
https://biguglyspider.github.io/math
0 stars 0 forks source link

Reference matrix potential leaks/dangles #15

Closed BigUglySpider closed 3 years ago

BigUglySpider commented 3 years ago

There is potential that, under certain circumstances, one can create a matrix of references which is initialised with a temporary value (e.g. making_vector(some_args..., 2, other_args...); can potentially be allowed).

This can lead to either leaks in memory or, much more likely, dangling references which appear to work for a short while.

BigUglySpider commented 3 years ago

On further inspection, this is in-line with the rest of reference implementations, which is to assume the user knows what they are doing and that they assign references correctly (as per any reference in C++).

This same concept definitely expands to now passing temporaries when making a reference matrix - doing so is explicitly deciding to delve into undefined behaviour.

As such, they will be left as is for the foreseeable future as of this comment. However, more work may be put into this at a later date to improve the library's safety. As such, it will be labelled as shelved rather than addressed.