On 28/04/14 17:41, Justin Ruggles wrote:
> ---
>  libavcodec/mjpegdec.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
> index b1192c5..1e5dd68 100644
> --- a/libavcodec/mjpegdec.c
> +++ b/libavcodec/mjpegdec.c
> @@ -1212,14 +1212,18 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
>  //    len -= 2;
>  
>      if (id == AV_RL32("JFIF")) {
> -        int t_w, t_h, v1, v2;
> +        int t_w, t_h, v1, v2, res_units;
>          skip_bits(&s->gb, 8); /* the trailing zero-byte */
>          v1 = get_bits(&s->gb, 8);
>          v2 = get_bits(&s->gb, 8);
> -        skip_bits(&s->gb, 8);
>  
> -        s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16);
> -        s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16);
> +        res_units = get_bits(&s->gb, 8);
> +        if (!res_units) {
> +            s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16);
> +            s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16);
> +        } else {
> +            skip_bits_long(&s->gb, 32);
> +        }
>  
>          if (s->avctx->debug & FF_DEBUG_PICT_INFO)
>              av_log(s->avctx, AV_LOG_INFO,
> 

Seems fine to me.

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to