Skip to content

Commit

Permalink
Merge pull request #7677 from rdengate/size_overflow_imread
Browse files Browse the repository at this point in the history
Fixes overflow when reading in large images
  • Loading branch information
lrineau committed Sep 6, 2023
2 parents 7cd107a + 3527e8e commit 0803718
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CGAL_ImageIO/include/CGAL/ImageIO_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ static void _swapImageData( _image *im )
Swap bytes depending on the endianness and the current architecture */
CGAL_INLINE_FUNCTION
int _readImageData(_image *im) {
unsigned long size, nread;
std::size_t size, nread;

if(im->openMode != OM_CLOSE) {
size = im->xdim * im->ydim * im->zdim * im->vdim * im->wdim;
Expand Down Expand Up @@ -1279,7 +1279,7 @@ int _readImageData(_image *im) {
Swap bytes depending on the endianness and the current architecture. */
CGAL_INLINE_FUNCTION
int _readNonInterlacedImageData(_image *im) {
unsigned long size, nread;
std::size_t size, nread;
unsigned char **vp, *buf;
unsigned int i, j, k, v, w;

Expand Down Expand Up @@ -1356,7 +1356,7 @@ int _readNonInterlacedImageData(_image *im) {
been read by _readImageHeader. The image buffer is interlaced. */
CGAL_INLINE_FUNCTION
int _readNonInterlacedFileData(_image *im) {
unsigned long size, nread;
std::size_t size, nread;
unsigned char *ptr1, *vp, *buf;
unsigned int i, j, k, v, w;

Expand Down

0 comments on commit 0803718

Please sign in to comment.