avcodec/tiff: move bpp check to after "end:"
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 8 Mar 2015 22:27:43 +0000 (23:27 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 12 Mar 2015 17:03:50 +0000 (18:03 +0100)
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)

Conflicts:

libavcodec/tiff.c

libavcodec/tiff.c

index 930da9f..d6e2295 100644 (file)
@@ -407,13 +407,6 @@ static int tiff_decode_tag(TiffContext *s)
                 s->bpp = -1;
             }
         }
                 s->bpp = -1;
             }
         }
-        if (s->bpp > 64U) {
-            av_log(s->avctx, AV_LOG_ERROR,
-                   "This format is not supported (bpp=%d, %d components)\n",
-                   s->bpp, count);
-            s->bpp = 0;
-            return AVERROR_INVALIDDATA;
-        }
         break;
     case TIFF_SAMPLES_PER_PIXEL:
         if (count != 1) {
         break;
     case TIFF_SAMPLES_PER_PIXEL:
         if (count != 1) {
@@ -556,6 +549,13 @@ static int tiff_decode_tag(TiffContext *s)
     default:
         av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag);
     }
     default:
         av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag);
     }
+    if (s->bpp > 64U) {
+        av_log(s->avctx, AV_LOG_ERROR,
+                "This format is not supported (bpp=%d, %d components)\n",
+                s->bpp, count);
+        s->bpp = 0;
+        return AVERROR_INVALIDDATA;
+    }
     bytestream2_seek(&s->gb, start, SEEK_SET);
     return 0;
 }
     bytestream2_seek(&s->gb, start, SEEK_SET);
     return 0;
 }