diff mbox series

[FFmpeg-devel,v2] avcodec/h264_sei: fix H.274 film grain parsing

Message ID 20210802120622.73097-1-ffmpeg@haasn.xyz
State New
Headers show
Series [FFmpeg-devel,v2] avcodec/h264_sei: fix H.274 film grain parsing | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Niklas Haas Aug. 2, 2021, 12:06 p.m. UTC
From: Niklas Haas <git@haasn.dev>

The current code reads the wrong number of bits for `fg_model_id`, which
causes all of the values downstream of this to contain corrupt values.

Fixes: corrupt SEI values
Fixes: 4ff73add5dbe6c319d693355be44df2e17a0b8bf

Signed-off-by: Niklas Haas <git@haasn.dev>
---
 libavcodec/h264_sei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer Aug. 2, 2021, 4:49 p.m. UTC | #1
On 8/2/2021 9:06 AM, Niklas Haas wrote:
> From: Niklas Haas <git@haasn.dev>
> 
> The current code reads the wrong number of bits for `fg_model_id`, which
> causes all of the values downstream of this to contain corrupt values.
> 
> Fixes: corrupt SEI values
> Fixes: 4ff73add5dbe6c319d693355be44df2e17a0b8bf
> 
> Signed-off-by: Niklas Haas <git@haasn.dev>
> ---
>   libavcodec/h264_sei.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
> index 7797f24650..329c2ea4f2 100644
> --- a/libavcodec/h264_sei.c
> +++ b/libavcodec/h264_sei.c
> @@ -424,7 +424,7 @@ static int decode_film_grain_characteristics(H264SEIFilmGrainCharacteristics *h,
>   
>       if (h->present) {
>           memset(h, 0, sizeof(*h));
> -        h->model_id = get_bits(gb, 8);
> +        h->model_id = get_bits(gb, 2);
>           h->separate_colour_description_present_flag = get_bits1(gb);
>           if (h->separate_colour_description_present_flag) {
>               h->bit_depth_luma = get_bits(gb, 3) + 8;

LGTM.
diff mbox series

Patch

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 7797f24650..329c2ea4f2 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -424,7 +424,7 @@  static int decode_film_grain_characteristics(H264SEIFilmGrainCharacteristics *h,
 
     if (h->present) {
         memset(h, 0, sizeof(*h));
-        h->model_id = get_bits(gb, 8);
+        h->model_id = get_bits(gb, 2);
         h->separate_colour_description_present_flag = get_bits1(gb);
         if (h->separate_colour_description_present_flag) {
             h->bit_depth_luma = get_bits(gb, 3) + 8;