diff mbox

[FFmpeg-devel,4/5] avcodec/mpeg4videodec: Do not corrupt bits_per_raw_sample

Message ID 20180429191918.2915-4-michael@niedermayer.cc
State Accepted
Commit 9e5d0860c043ba5d1e48c0f8c42b0fe3b6cbeba4
Headers show

Commit Message

Michael Niedermayer April 29, 2018, 7:19 p.m. UTC
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/mpeg4videodec.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Kieran Kunhya April 29, 2018, 8:26 p.m. UTC | #1
On Sun, 29 Apr 2018 at 20:20 Michael Niedermayer <michael@niedermayer.cc>
wrote:

> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/mpeg4videodec.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>

OK
Michael Niedermayer May 16, 2018, 8:56 p.m. UTC | #2
On Sun, Apr 29, 2018 at 08:26:47PM +0000, Kieran Kunhya wrote:
> On Sun, 29 Apr 2018 at 20:20 Michael Niedermayer <michael@niedermayer.cc>
> wrote:
> 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/mpeg4videodec.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> 
> OK

will apply

(sorry for delay, this depended on the other patch)

thanks

[...]
diff mbox

Patch

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 9318d7bd4e..33cdc7a1b2 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -2999,6 +2999,7 @@  static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
 {
     MpegEncContext *s = &ctx->m;
     int width, height;
+    int bits_per_raw_sample;
 
             skip_bits1(gb); /* random_accessible_vol */
             skip_bits(gb, 8); /* video_object_type_indication */
@@ -3014,8 +3015,8 @@  static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
                     return AVERROR_INVALIDDATA;
                 }
 
-                s->avctx->bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */
-                if (s->avctx->bits_per_raw_sample == 10) {
+                bits_per_raw_sample = get_bits(gb, 4); /* bit_depth */
+                if (bits_per_raw_sample == 10) {
                     if (ctx->rgb) {
                         s->avctx->pix_fmt = AV_PIX_FMT_GBRP10;
                     }
@@ -3024,9 +3025,10 @@  static int decode_studio_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb)
                     }
                 }
                 else {
-                    avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", s->avctx->bits_per_raw_sample);
+                    avpriv_request_sample(s->avctx, "MPEG-4 Studio profile bit-depth %u", bits_per_raw_sample);
                     return AVERROR_PATCHWELCOME;
                 }
+                s->avctx->bits_per_raw_sample = bits_per_raw_sample;
             }
             if (ctx->shape == RECT_SHAPE) {
                 check_marker(s->avctx, gb, "before video_object_layer_width");