Skip to content

Infinite loop in multiply when applied to NxN and N shaped arrays #267

Description

@Caellian

In browser environment, when I used multiply, it got stuck on NDIter in an infinite loop.

  • The cause is that NDArray arity isn't checked by the multiply function and it assumes it will work with two matrices. If one tries to multiple a matrix ([[...],[...],[...]]) with a vector [..], the c2 value is undefined.
  • This causes a subsequently constructed result matrix to have 0 size, i.e. undefined length.
  • Which isn't checked either when NDIter is constructed, resulting in an infinite loop because index > undefined is true (because undefined is cast to 0).

Solution

  • Check if vector is provided as second argument and turn it into a matrix.
    • Handle vectors from NDIter?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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