Browse code

avcodec/tiff: move bpp check to after "end:"

This ensures that all current and future code-pathes get bpp checked

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d5e9fc782150d4596c72440a0aa02b7f4f1254b1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2015/03/09 07:27:43
Showing 1 changed files
... ...
@@ -839,13 +839,6 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
839 839
                 s->bpp = -1;
840 840
             }
841 841
         }
842
-        if (s->bpp > 64U) {
843
-            av_log(s->avctx, AV_LOG_ERROR,
844
-                   "This format is not supported (bpp=%d, %d components)\n",
845
-                   s->bpp, count);
846
-            s->bpp = 0;
847
-            return AVERROR_INVALIDDATA;
848
-        }
849 842
         break;
850 843
     case TIFF_SAMPLES_PER_PIXEL:
851 844
         if (count != 1) {
... ...
@@ -1158,6 +1151,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
1158 1158
         }
1159 1159
     }
1160 1160
 end:
1161
+    if (s->bpp > 64U) {
1162
+        av_log(s->avctx, AV_LOG_ERROR,
1163
+                "This format is not supported (bpp=%d, %d components)\n",
1164
+                s->bpp, count);
1165
+        s->bpp = 0;
1166
+        return AVERROR_INVALIDDATA;
1167
+    }
1161 1168
     bytestream2_seek(&s->gb, start, SEEK_SET);
1162 1169
     return 0;
1163 1170
 }