Fix nasty crash when cropping YUV.
authorCarl Hetherington <cth@carlh.net>
Tue, 4 Jun 2013 09:39:53 +0000 (10:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 4 Jun 2013 09:39:53 +0000 (10:39 +0100)
src/lib/image.cc

index f0a38f4e9418bdd941f86950279e4962434de779..bba7d6be5d0762efba32338ba8e158209e4ed17b 100644 (file)
@@ -211,8 +211,8 @@ Image::crop (Crop crop, bool aligned) const
                /* Start of the source line, cropped from the top but not the left */
                uint8_t* in_p = data()[c] + crop.top * stride()[c];
                uint8_t* out_p = out->data()[c];
-               
-               for (int y = 0; y < cropped_size.height; ++y) {
+
+               for (int y = 0; y < out->lines(c); ++y) {
                        memcpy (out_p, in_p + crop_left_in_bytes, cropped_width_in_bytes);
                        in_p += stride()[c];
                        out_p += out->stride()[c];