Mercurial > octave-nkf
changeset 17561:b41860a0bc24
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.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Thu, 03 Oct 2013 22:19:12 -0400 |
parents | 225ec9a0222a |
children | 76a8a179bf5b |
files | libinterp/dldfcn/__magick_read__.cc |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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<double>((1 << bitdepth) - 1) / MaxRGB; + const double divisor = static_cast<double>((uint64_t (1) << bitdepth) - 1) / MaxRGB; const P *img_fvec = img.fortran_vec (); const P *a_fvec = alpha.fortran_vec ();