]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/webp.c
img2dec: check av_new_packet return value
[ffmpeg] / libavcodec / webp.c
index f9f8bfcbff801984941c3cea9998b1cdb45c6c5b..b98fa4dea4755e2f8ad509e33ae471fc3d26ca45 100644 (file)
@@ -476,7 +476,9 @@ static int decode_entropy_image(WebPContext *s)
     max = 0;
     for (y = 0; y < img->frame->height; y++) {
         for (x = 0; x < img->frame->width; x++) {
-            int p = GET_PIXEL_COMP(img->frame, x, y, 2);
+            int p0 = GET_PIXEL_COMP(img->frame, x, y, 1);
+            int p1 = GET_PIXEL_COMP(img->frame, x, y, 2);
+            int p  = p0 << 8 | p1;
             max = FFMAX(max, p);
         }
     }
@@ -561,7 +563,9 @@ static HuffReader *get_huffman_group(WebPContext *s, ImageContext *img,
     if (gimg->size_reduction > 0) {
         int group_x = x >> gimg->size_reduction;
         int group_y = y >> gimg->size_reduction;
-        group       = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 2);
+        int g0      = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 1);
+        int g1      = GET_PIXEL_COMP(gimg->frame, group_x, group_y, 2);
+        group       = g0 << 8 | g1;
     }
 
     return &img->huffman_groups[group * HUFFMAN_CODES_PER_META_CODE];