[ismrmrd] 05/16: Bug fix. Check if data type and then compute the size.
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Jan 14 20:02:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to annotated tag v1.2.0
in repository ismrmrd.
commit d03f1e5d21a8c4fe9d9625e2999da2fbd0298c14
Author: Souheil Inati <souheil.inati at nih.gov>
Date: Sun Nov 23 22:08:08 2014 -0500
Bug fix. Check if data type and then compute the size.
---
libsrc/ismrmrd.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/libsrc/ismrmrd.c b/libsrc/ismrmrd.c
index 2887862..b917496 100644
--- a/libsrc/ismrmrd.c
+++ b/libsrc/ismrmrd.c
@@ -292,13 +292,16 @@ size_t ismrmrd_size_of_image_data(const ISMRMRD_Image *im) {
return 0;
}
+ if (ismrmrd_sizeof_data_type(im->head.data_type) == 0) {
+ ISMRMRD_PUSH_ERR(ISMRMRD_TYPEERROR, "Invalid image data type");
+ return 0;
+ }
+
num_data = im->head.matrix_size[0] * im->head.matrix_size[1] *
im->head.matrix_size[2] * im->head.channels;
data_size = num_data * ismrmrd_sizeof_data_type(im->head.data_type);
- if (data_size == 0) {
- ISMRMRD_PUSH_ERR(ISMRMRD_TYPEERROR, "Invalid image data type");
- }
+
return data_size;
}
@@ -417,14 +420,16 @@ size_t ismrmrd_size_of_ndarray_data(const ISMRMRD_NDArray *arr) {
return 0;
}
+ if (ismrmrd_sizeof_data_type(arr->data_type) == 0 ) {
+ ISMRMRD_PUSH_ERR(ISMRMRD_TYPEERROR, "Invalid NDArray data type");
+ return 0;
+ }
+
for (n = 0; n < arr->ndim; n++) {
num_data *= arr->dims[n];
}
data_size = num_data * ismrmrd_sizeof_data_type(arr->data_type);
- if (data_size == 0) {
- ISMRMRD_PUSH_ERR(ISMRMRD_TYPEERROR, "Invalid NDArray data type");
- }
return data_size;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ismrmrd.git
More information about the debian-science-commits
mailing list