-
Notifications
You must be signed in to change notification settings - Fork 276
Unchecked input for SP compute crashes program #1388
Comments
@scottpurdy is there something we can do about this? We've discussed this long ago, a solution would be (a bigger refactor) to use |
Similar issue on python-bindings side is #1385 |
I think it is fine to require the caller to pass the right size array as long as it is documented. It would be nice to use sparse representations everywhere rather than passing UInt32 dense arrays that just contain binary values but that would be a somewhat involved refactor that I don't think we have the stomach for right now (would really require a lot of time from @lscheinkman ) |
agreed. But it's nice to hear the notion, esp since the discussed community nupic.core fork, I think the (eigen) sparse repr. all round the codebase would be the way forward. |
the compute in SP
void compute(UInt input[], bool learn, UInt output[]);
unfortunately, the data are passed as
UInt*
(typically fromvector.data()
with no way of checking the correct array sizes!The check would be quite simple:
sp.getNumInputs() == input.size() && sp.getNumColumns() == out.size()
but we pass the pointer
T*
and cannot reconstruct the array properly, we cannot know the sizes of input parameters to compute()!Providing a wrong size -smaller- (large is ok) crashes the program.
The text was updated successfully, but these errors were encountered: