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

transform.cc: potential index overflow #3652

Closed
ghost opened this issue Jul 29, 2019 · 2 comments
Closed

transform.cc: potential index overflow #3652

ghost opened this issue Jul 29, 2019 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 29, 2019

Here, https://github.com/dmlc/tvm/blob/0858c5ad42faefeefb7c24942a6bcbf075c4c4d7/src/relay/op/tensor/transform.cc#L1454


for (size_t i = 0; i < x_shape.size(); i++) {
    CHECK(reporter->AssertEQ(cond_shape[i], x_shape[i]))
        << "Shape of condition " << condition->shape
        << " must be either equal to x or has dimension of 1.";
  }

If cond_shape.size()=1 , and x_shape.size() = 2, then AssertEQ(cond_shape[i], x_shape[i]) will cause segment fault (array index overflow).

@tqchen
Copy link
Member

tqchen commented Jul 30, 2019

@YPBlib can you send a PR to add additional checks to guard against this case? I think there is a case when cond_shape.size() == 1 but x_shape.size is not. which we need to have special way of handling it

@cchung100m
Copy link
Contributor

Hi @YPBlib , @tqchen ,

I'm interested in working on this if no one else has signed up. I would appreciate if you can share more detailed thought for the implementation of additional check.

Many thanks,

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

No branches or pull requests

2 participants