Lunderberg opened a new pull request, #16543:
URL: https://github.com/apache/tvm/pull/16543

   Prior to this commit, the `MakePackedAPI` pass would output steps in the 
following order:
   
   1. Check the number of arguments.
   2. All `LetStmt` produced by the `ArgBinder`
   3. `AssertStmt` for the Type code checks for each argument.
   4. Additional `AssertStmt` produced by the `ArgBinder`.
   
   This order can cause segfaults if a function was provided incorrect 
arguments.  For example, an integer argument passed to a function expecting a 
`DLTensor*` would be dereferenced to find the tensor's data pointer (step (2)) 
before checking if it is valid to perform that dereference (step (3)).  The 
same would occur when reading the size of a tensor's axes (step (2)) before 
checking whether the tensor is the correct dimensionality (step (4)).
   
   This commit updates the steps to the following order.
   
   1. Check the number of arguments.
   2. Check the type code of each argument.
   3. All `LetStmt` and `AssertStmt` produced by the `ArgBinder`, in the order 
in which they are generated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to