Browse code

imgutils: Fix illegal read.

Found with address sanitizer.

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit c693aa6f71b4f539cf9df67ba42f4b1932981687)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Thierry Foucu authored on 2011/11/19 10:36:50
Showing 1 changed files
... ...
@@ -117,7 +117,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
117 117
         has_plane[desc->comp[i].plane] = 1;
118 118
 
119 119
     total_size = size[0];
120
-    for (i = 1; has_plane[i] && i < 4; i++) {
120
+    for (i = 1; i < 4 && has_plane[i]; i++) {
121 121
         int h, s = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
122 122
         data[i] = data[i-1] + size[i-1];
123 123
         h = (height + (1 << s) - 1) >> s;