isl_mat_drop_cols: check for valid column range
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Fri, 8 Sep 2017 10:36:52 +0000 (8 12:36 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Sat, 16 Sep 2017 08:42:56 +0000 (16 10:42 +0200)
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
isl_mat.c

index b0ea0e0..d444576 100644 (file)
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -1401,8 +1401,8 @@ struct isl_mat *isl_mat_drop_cols(struct isl_mat *mat, unsigned col, unsigned n)
                return mat;
 
        mat = isl_mat_cow(mat);
-       if (!mat)
-               return NULL;
+       if (check_col_range(mat, col, n) < 0)
+               return isl_mat_free(mat);
 
        if (col != mat->n_col-n) {
                for (r = 0; r < mat->n_row; ++r)