From e478e965a3b19f20583dca50c030d507242b6ff5 Mon Sep 17 00:00:00 2001 From: Patrick Avery Date: Thu, 28 Mar 2024 12:31:50 -0500 Subject: [PATCH] Fix integer overflow issue in fabio fabio would perform some arithmetic with the frame number we provided it to compute byte offsets for GE images. If our frame number was np.uint32, for large datasets, this would cause an overflow error, since uint32 would be used for the byte offset. Instead, ensure a python integer is passed, which *cannot* overflow. Signed-off-by: Patrick Avery --- hexrd/imageseries/load/imagefiles.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hexrd/imageseries/load/imagefiles.py b/hexrd/imageseries/load/imagefiles.py index 6f954f996..e49628515 100644 --- a/hexrd/imageseries/load/imagefiles.py +++ b/hexrd/imageseries/load/imagefiles.py @@ -227,7 +227,10 @@ def _load_data(self, filename, frame=None): if frame is None: data = img.data else: - data = img.getframe(frame).data + # Fabio does some arithmetic with the frame number. + # This can cause overflows if np.uint32 is used, so + # make sure we convert to a Python int before passing to fabio. + data = img.getframe(int(frame)).data return _process_data(filename, data)