# HG changeset patch # User Mike Miller # Date 1380853152 14400 # Node ID b41860a0bc2418db91a7465184b9073cfd5ec24f # Parent 225ec9a0222a9fcbd4c5962dc944ea0553b97491 Fix integer overflow in imwrite with floating point and uint32 images * __magick_read__.cc (encode_uint_image): Use uint64_t to avoid integer overflow with default integer type. diff -r 225ec9a0222a -r b41860a0bc24 libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Thu Oct 03 16:48:19 2013 -0700 +++ b/libinterp/dldfcn/__magick_read__.cc Thu Oct 03 22:19:12 2013 -0400 @@ -1033,7 +1033,7 @@ // From GM documentation: // Color arguments are must be scaled to fit the Quantum size according to // the range of MaxRGB - const double divisor = static_cast((1 << bitdepth) - 1) / MaxRGB; + const double divisor = static_cast((uint64_t (1) << bitdepth) - 1) / MaxRGB; const P *img_fvec = img.fortran_vec (); const P *a_fvec = alpha.fortran_vec ();