Skip to content

Commit

Permalink
[ndarray] Fix ndarray_from_tuple reading out of _shape->items bounds (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixNumworks committed Jun 26, 2023
1 parent 26051d7 commit 319df10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions code/ndarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,10 +652,10 @@ ndarray_obj_t *ndarray_new_ndarray_from_tuple(mp_obj_tuple_t *_shape, uint8_t dt
// the function should work in the general n-dimensional case
size_t *shape = m_new(size_t, ULAB_MAX_DIMS);
for(size_t i=0; i < ULAB_MAX_DIMS; i++) {
if(i < ULAB_MAX_DIMS - _shape->len) {
shape[i] = 0;
if(i >= _shape->len) {
shape[ULAB_MAX_DIMS - i] = 0;
} else {
shape[i] = mp_obj_get_int(_shape->items[i]);
shape[ULAB_MAX_DIMS - i] = mp_obj_get_int(_shape->items[i]);
}
}
return ndarray_new_dense_ndarray(_shape->len, shape, dtype);
Expand Down
2 changes: 1 addition & 1 deletion code/ulab.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "user/user.h"
#include "utils/utils.h"

#define ULAB_VERSION 6.3.1
#define ULAB_VERSION 6.3.2
#define xstr(s) str(s)
#define str(s) #s

Expand Down

0 comments on commit 319df10

Please sign in to comment.